[Insight-users] problem of JPEG2000

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Sep 14 11:20:26 EDT 2006


Sam,

	I have looked at your issue, I believe this is fixed in current ITK CVS 
and will be integrated in ITK 3.0. What I want you to do is completely 
remove the source AND binary tree of ITK and rebuild it from scratch. 
Your image does not contain a j2k stream so you should not have to 
struggle with this library at all. So again please try again *from 
scratch* (I insist) to download (from cvs) a copy of ITK and then build 
it. You do not need to build TESTING, you only need to build the IO 
Examples.

	If this still does not work, please indicate the CVS client you were 
using, the option you used for CVS. The compiler you are using. The 
CMake version you are using. And if you reproduced the problem with a 
file different than the one you sent me, then please send me a copy of 
the same you are reproducing the bug with.

Regards,
Mathieu

Xuejun wrote:
> Hi, Luis;
> 
>  
> 
> I already updated all of ITK files by CVS, but unfortunately the bug of 
> DICOM image reading is still there and I sent the converted image for 
> Mathieu’s review. Since I do not get any response so far, I am looking 
> forward to the help on this issue.
> 
>  
> 
>  
> 
> Regards,
> 
> Sam
> 
>  
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> Sent: Thursday, September 14, 2006 10:52 AM
> To: Xuejun
> Cc: 'Mathieu Malaterre'; insight-users at itk.org
> Subject: Re: [Insight-users] problem of JPEG2000
> 
>  
> 
>  
> 
> Hi Sam,
> 
>  
> 
>  
> 
> It is unlikely that updating "several" gdcm files you
> 
> will get a consistent set of source code.
> 
>  
> 
> Please use a full update of your CVS checkout of ITK.
> 
>  
> 
>  
> 
>      Thanks
> 
>  
> 
>  
> 
>        Luis
> 
>  
> 
>  
> 
> ----------------
> 
> Xuejun wrote:
> 
>>  Hi, Mathieu;
> 
>>
> 
>> 
> 
>>
> 
>>  I updated several gdcm files but encountered a JPEG2000 problem during
> 
>>  compilations, one of which is listed as below:
> 
>>
> 
>> 
> \Download\program\kitware\InsightToolkit-2.8.1\InsightToolkit-2.8.1\Utilities\gdcm\src\gdcmFileHelper.cxx(735) 
> 
> 
>>  : error C2051: case expression not constant
> 
>>
> 
>>  Although I downloaded the openJPEG library: LibOpenJPEG.lib, and added a
> 
>>  command LINK_LIBRARIES (LibOpenJPEG) in the CMakeLists.txt file of the
> 
>>  gdcm directory.
> 
>>
> 
>> 
> 
>>
> 
>>  Would you please let me know how to fix it?
> 
>>
> 
>> 
> 
>>
> 
>>  Regards,
> 
>>
> 
>>  Sam
> 
>>
> 
>> 
> 
>>
> 
>> 
> 
>>
> 
>> 
> 
>>
> 
>>  -----Original Message-----
> 
>>  From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>  Sent: Tuesday, September 05, 2006 6:09 PM
> 
>>  To: Xuejun
> 
>>  Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> 
> 
>>
> 
>>  Yes this was fixed in ITK CVS. I would recommend updating ITK and trying
> 
>>
> 
>>  it out. It will be available in ITK 3.0
> 
>>
> 
>> 
> 
>>
> 
>>  Mathieu
> 
>>
> 
>> 
> 
>>
> 
>>  Xuejun wrote:
> 
>>
> 
>> >  Hi, Mathieu;
> 
>>
> 
>> > 
> 
>>
> 
>> >  Would you please let me know if the bug was resolved or not and how 
> to use
> 
>>
> 
>> >  the file?
> 
>>
> 
>> > 
> 
>>
> 
>> >  Regards,
> 
>>
> 
>> >  Sam
> 
>>
> 
>> > 
> 
>>
> 
>> > 
> 
>>
> 
>> >  -----Original Message-----
> 
>>
> 
>> >  From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>
> 
>> >  Sent: Thursday, August 31, 2006 1:21 PM
> 
>>
> 
>> >  To: Xuejun
> 
>>
> 
>> >  Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> > 
> 
>>
> 
>> >  Oh I remember now. I did an early patch and attached it to the bug
> 
>>
> 
>> >  tracker, but it is incorrect. I need to revise it. Give me until 
> tomorrow.
> 
>>
> 
>> > 
> 
>>
> 
>> >  Mathieu
> 
>>
> 
>> > 
> 
>>
> 
>> >  Xuejun wrote:
> 
>>
> 
>> > > http://public.kitware.com/Bug/bug.php?op=show&bugid=3668
> 
>>
> 
>> > >
> 
>>
> 
>> > >
> 
>>
> 
>> > > -----Original Message-----
> 
>>
> 
>> > > From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>
> 
>> > > Sent: Wednesday, August 30, 2006 5:23 PM
> 
>>
> 
>> > > To: Xuejun
> 
>>
> 
>> > > Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> > >
> 
>>
> 
>> > > Sam,
> 
>>
> 
>> > >
> 
>>
> 
>> > >        if each pixel is indeed 2 bytes (==16bits), why does the
> 
>>  header says
> 
>>
> 
>> > >
> 
>>
> 
>> > > 14bits for the Bits Allocated instead of directly 16bits ? I have been
> 
>>
> 
>> > > working on DICOM file for a long time, and I am convinced this is a bug
> 
>>
> 
>> > > in the library you are using. Before applying the patch (yes it's
> 
>>
> 
>> > > ready), I need to refer to the correct manufactor of the DICOM lib.
> 
>>
> 
>> > >
> 
>>
> 
>> > >        For instance, the DICOM library is referring to the 'Signed 
> Short
> 
>>
> 
>> > > Lossless Bug' from DicomObject:
> 
>>
> 
>> > >
> 
>>
> 
>> > > http://www.medicalconnections.co.uk/html/lossless_bug.html
> 
>>
> 
>> > >
> 
>>
> 
>> > >        Why so, because we are patching the DICOM library to handle
> 
>>  illegal
> 
>>
> 
>> > > DICOM file. Therefore we might not be able to handle other illegal 
> DICOM
> 
>>
> 
>> > > file from different constructors that suffer from similar problems.
> 
>>
> 
>> > > Example maybe next time we found 14bits, it actually means 12 
> instead of
> 
>>
> 
>> > > 16 bits for you.
> 
>>
> 
>> > >
> 
>>
> 
>> > > Thanks for your time
> 
>>
> 
>> > > Mathieu
> 
>>
> 
>> > >
> 
>>
> 
>> > > Xuejun wrote:
> 
>>
> 
>> > >> I will contact with them regarding this issue, but I am not sure what
> 
>>
> 
>> > >> they will do.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Actually for about one year I have been working on this kind of DICOM
> 
>>
> 
>> > >> image with our C++ code (not on ITK) on SUN workstations under Solaris
> 
>>
> 
>> > >> operating system. It works well in reading the image although the 
> DICOM
> 
>>
> 
>> > >> image saved with the code cannot be recognized by IDL, while 
> DICOMWorks
> 
>>
> 
>> > >> can. I encountered this DICOM reading problem through ITK on PC 
> windows.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> I am not familiar with the specifications of DICOM. Based on my
> 
>>
> 
>> > >> observations, I think it should be the second one of your hypotheses,
> 
>>
> 
>> > >> because I checked the number of pixels is 2139111, with each pixel
> 
>>
> 
>> > >> taking 2 byte (unsigned short). Then the total number is 4278222, the
> 
>>
> 
>> > >> same as you found.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> I very appreciate you to resolve this as quickly as possible.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Thanks
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Sam
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> -----Original Message-----
> 
>>
> 
>> > >> From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>
> 
>> > >> Sent: Tuesday, August 29, 2006 3:23 PM
> 
>>
> 
>> > >> To: Xuejun
> 
>>
> 
>> > >> Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Hi Sam,
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>             If you are in touch with those guys, could you please
> 
>>
> 
>> > >> forward them this:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> * DICOM spec is at: http://medical.nema.org
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> * PixelData Length for this image is incorrect:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Two hypothesis:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> 1. You use the pack bits approach in which case the PixelData length
> 
>>
> 
>> > > should:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Rows*Colums*(BitsAllocated/8)
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> In your case:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> 1833*1167*(14/8) = 3743444.25 (need to round to next byte)
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> whereas your image is: 4278222
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> 2. Your image is indeed encoded on 16bits (no pack bits 
> mechanism), then
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> BitsAllocated is incorrectly set to 14, and should be set to 16.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Mathieu
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Ps: feel free to CC me in the discussion.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>
> 
>>
> 
>> > >> Xuejun wrote:
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>>  This DICOM comes from a new type of medical imaging system. So you
> 
>>
> 
>> > > please
> 
>>
> 
>> > >>>  keep it as confidential.
> 
>>
> 
>> > >>>  Thanks
> 
>>
> 
>> > >>>  Sam
> 
>>
> 
>> > >>>  -----Original Message-----
> 
>>
> 
>> > >>>  From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>
> 
>> > >>>  Sent: Tuesday, August 29, 2006 1:46 PM
> 
>>
> 
>> > >>>  To: Xuejun
> 
>>
> 
>> > >>>  Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> > >>>  You are a very lucky person :) I tried with:
> 
>>
> 
>> > >>>  - TomoVision: crash
> 
>>
> 
>> > >>>  - dcmtk: incorrect result
> 
>>
> 
>> > >>>  - eFilm: does not open file
> 
>>
> 
>> > >>>  - osiris: does not recognize the file
> 
>>
> 
>> > >>>  - tviewer: incorrect result
> 
>>
> 
>> > >>>  Can you please tell me where this image is coming from ?
> 
>>
> 
>> > >>>  Thank you
> 
>>
> 
>> > >>>  Mathieu
> 
>>
> 
>> > >>>  Xuejun wrote:
> 
>>
> 
>> > >>>> That is the software we are using to display the DICOM image. In
> 
>>
> 
>> > >> addition,
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>>> IDL6.0 also works well to display such DICOM image.
> 
>>
> 
>> > >>>> Thanks
> 
>>
> 
>> > >>>> Sam
> 
>>
> 
>> > >>>> -----Original Message-----
> 
>>
> 
>> > >>>> From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
> 
>>
> 
>> > >>>> Sent: Tuesday, August 29, 2006 1:01 PM
> 
>>
> 
>> > >>>> To: Xuejun
> 
>>
> 
>> > >>>> Subject: Re: [Insight-users] Fwd: Help on DICOM image reading bug
> 
>>
> 
>> > >>>> Xuejun wrote:
> 
>>
> 
>> > >>>>> Hi, Mathieu;
> 
>>
> 
>> > >>>>> First of all, I very appreciate your efforts to resolve this 
> reading
> 
>>
> 
>> > >> bug.
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>>>> Because this DICOM image can be displayed normally using some
> 
>>
> 
>> > >> software, I
> 
>>
> 
>> > >>
> 
>>
> 
>> > >>>> am
> 
>>
> 
>> > >>>>> confused by the "illegal DICOM file".
> 
>>
> 
>> > >>>> I would be interested in those 'some software', I believe only
> 
>>
> 
>> > >>>> DicomWorks can read this image. Can you name a few other ?
> 
>>
> 
>> > >>>> Thanks
> 
>>
> 
>> > >>>> Mathieu
> 
>>
> 
>> > >
> 
>>
> 
>> > 
> 
>>
> 
>> > 
> 
>>
> 
>>
> 
>>  ------------------------------------------------------------------------
> 
>>
> 
>>  _______________________________________________
> 
>>  Insight-users mailing list
> 
>>  Insight-users at itk.org
> 
>>  http://www.itk.org/mailman/listinfo/insight-users
> 
>  
> 



More information about the Insight-users mailing list