[vtkusers] [Gdcm2] vtkGDCMImageReader for reading JPEG 2000 lossy compressed image data

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Sep 15 17:22:48 EDT 2008


On Mon, Sep 15, 2008 at 11:16 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> 'lo JP, long time !
>
> On Mon, Sep 15, 2008 at 6:59 PM, Jean-Pierre Roux
> <jpr at creatis.insa-lyon.fr> wrote:
>> Mathieu Malaterre wrote:
>>>
>>> Madhu,
>>>
>>> [CC'ing everybody to close the loop.]
>>> TransferSyntax is 1.2.840.10008.1.2.4.91 [JPEG 2000 Image Compression]
>>> NumberOfDimensions: 3
>>> Dimensions: (1024,200,200)
>>> Origin: (0,0,0)
>>> Spacing: (1,1,0)
>>> DirectionCosines: (1,0,0,0,1,0)
>>> Rescale Intercept/Slope: (0,1)
>>> SamplesPerPixel    :1
>>> BitsAllocated      :8
>>> BitsStored         :8
>>> HighBit            :7
>>> PixelRepresentation:1
>>> ScalarType found   :INT8
>>> PhotometricInterpretation: MONOCHROME2
>>> TransferSyntax: 1.2.840.10008.1.2.4.91
>>> Orientation Label: AXIAL
>>>
>>>
>>
>> Hi, Mathieu!
>>>
>>>
>>
>> [...]
>>
>> I think reading 'extra large' Dicom images will be very soon a major
>> challenge for any DICOM reader.
>> I have a 'Enhanced CT' image whose size is 1024x1024x2000 ...
>
> I perfectly understand that. First milestone remains full GDCM 1.x
> replacement unfortunately, that's why I differed this feature request
> for now. I have been thinking about it and I've been learning how they
> do that in the IJG code. So this will be challenging but definitely
> fun to code !
>
>> On gdcm1.3 I thought about writting a 'frame by frame Reader'.
>> It was OK for uncompresseed images, but I had no idea on how to proceed with
>> JPEG, or J2K compressed images, so I gave up :-(
>> Did you plan anything, on gdcm2 ?
>
> In fact uncompressed image is the most difficult case, since you have
> to do pointer arithmetic...
> May I recommend you to switch to gdcm 2.x ;)
> just for record Madhu send me this very large image, because there was
> a bug (that I did not know of), so i decided to split his image:
>
>  $ gdcmraw -i input.dcm -o myprefix --split-frags --pattern %03d.jp2
>  $ gdcmimg -i myprefix000.jp2 -o output.dcm
>
> And here you go, you have the first slice of the J2K compressed
> multiframes available as a single DICOM file, not bad for a two line
> shell script ?
>
>  I have not implemented the more complex multiframes uncompressed
> case, please fill in a bug report so that I do not forget about it,
> thanks.

Actually now that you are saying it... You could compressed first your
uncompressed image, and then split it :=

 $ gdcmconv --j2k -i input.dcm -o compressed.dcm
 $ gdcmraw -i compressed.dcm -o myprefix --split-frags --pattern %03d.jp2
 $ gdcmimg -i myprefix000.jp2 -o output.dcm

Which is now a 3 lines shell script :)

 And then back again you can uncompress it:

 $ gdcmconv --raw -i output.dcm -o uncompressed-single-frame.dcm

Of course this is not recommended, to compress/decompress just to
split a multiframes image, but I thought it was funny :)

-- 
Mathieu



More information about the vtkusers mailing list