rii-mango / jpeglosslessdecoder Goto Github PK
View Code? Open in Web Editor NEWA JPEG Lossless decoder.
License: MIT License
A JPEG Lossless decoder.
License: MIT License
Hallo,
nice library. After a couple of hours searched i found this library to decode JPEG Lossless files. My task was to do a own implementation for JPEG Lossless parsing for DICOM files. This code should be contributed to the "TwelveMonkeys" ImageLibrary, which we use in our DICOM Software.
(Github Link for "TwelveMonkeys")
Maybe there is a possibility to integrate your Code into the "TwelveMonkeys" Project? If you want, I can do the implementation. I know you use the MIT license, but i wanted to hear, if its okay for you.
Best regards
Hermann
Hello,
I've got a problem. I have JPEG Lossless images with 16 bit precision and 1 component (your library and the DICOM information tells me that)
try {
//read in test
FileInputStream inStream = new FileInputStream("test0.pixeldata");
int avaibleBytes = inStream.available();
byte[] data = new byte[avaibleBytes];
inStream.read(data);
//create decoder here
JPEGLosslessDecoder decoder = new JPEGLosslessDecoder(data);
int[][] decoded = decoder.decode();
// added getFrameHeader in JPEGLosslessDecoder for this prints here
FrameHeader header = decoder.getFrameHeader();
System.out.println("Components: " + header.getNumComponents());
System.out.println("Precision : " + header.getPrecision());
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for(int i = 0; i < decoded[0].length; i++){
if(min > decoded[0][i]){
min = decoded[0][i];
}
if(max < decoded[0][i]){
max = decoded[0][i];
}
}
System.out.println("Max value: " + max);
System.out.println("Min value: " + min);
} catch(Exception ex){
ex.printStackTrace();
}
The console output is:
Components: 1
Precision : 16
Max value: 67007
Min value: 63536
Why does some values exceeds the range of 16 bit precision? I assumed that the values could be wrapped safely by an Java short.
I attached you the image stream from a DICOM file saved to an .pixeldata - file in a .zip.
Best regards & Thanks
Hermann
Hi. Firstly, thank so much for writing this. I'm writing a DICOM parser in a different language (Xojo) and, like many people, managed to read the elements in the DICOM file and be able to generate an image if the PixelData was uncompressed but have struggled to decode lossless JPEG.
I'm attempting to port this Java library to Xojo. I have one question. In the readme it says:
// single component
int[] decompressedData = decoder.decode()[0];
The bytes in decompressedData
what format are they? Can I consider them the same as if they were in DICOM's "uncompressed" format. I.e I just need to apply RescaleSlope
and RescaleIntercept
and windowing to them or have they been decoded to a different JPEG format?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.