Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying transfer syntax to read images #1315

Open
adityaapte opened this issue Jun 7, 2023 · 0 comments
Open

Specifying transfer syntax to read images #1315

adityaapte opened this issue Jun 7, 2023 · 0 comments

Comments

@adityaapte
Copy link

adityaapte commented Jun 7, 2023

I am encountering an issue where image read results in incorrect values if transfer syntax is other than 1.2.840.10008.1.2. Below is code in GNU-OCTAVE. Is there a way to specify transfer syntax UID so that reader can apply correct decompression. (dcm4che-5.17.0)

            dcmFile = '/path/to/scmFile.dcm';
            readerSpi = javaObject('org.dcm4che3.imageio.plugins.dcm.DicomImageReaderSpi');
            dcmImgReader = javaObject('org.dcm4che3.imageio.plugins.dcm.DicomImageReader',readerSpi);
            inputStreamObj = javaObject("java.io.FileInputStream",dcmFile);
            in = javaObject("org.dcm4che3.io.DicomInputStream",inputStreamObj);
            dcmImgReader.setInput(in)
            param = dcmImgReader.getDefaultReadParam;
            raster = dcmImgReader.readRaster(0, param); % only one image. hence image index of 0.
            h = raster.getHeight;
            w = raster.getWidth;
            numBands = raster.getNumBands;
            if numBands > 1
                error('Multi-band image not supported')
            end
            b = 0; % 1st band
            sliceV = raster.getSamples(0,0,w,h,b,[]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant