[Insight-users] Read Write Dicom Image

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Mar 30 06:10:54 EDT 2009


On Mon, Mar 30, 2009 at 11:42 AM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> Hi Hui,
>
> On Fri, Mar 27, 2009 at 11:21 PM, Hui Wang <cougarhui at yahoo.com> wrote:
>> Hi, Mathieu,
>>
>> Attached two images. DicomInput.dcm is the one I am working with and it
>> causes the error. But DicomImageReadWrite.cxx works fine on the
>> other one which I downloaded from itk source codes. Would you please try
>> DicomImageReadWriter.exe on DicomInput.dcm? Thanks in advance.
>
> Thanks for the input image. Here is what is happening:
>
> 1. You DICOM file contains digital trash:
> ...
> (130d,0000) ?? (UL) 1099164365\1276292990\3804772504\555532589
> # 16,1 (4)  Generic Group Length
> (140d,0000) ?? (UL) 835531882\1219434392\151033222\3313626383
> # 16,1 (4)  Generic Group Length
> (150d,0000) ?? (UL) 4259307444\1128414896\4113509537\2144277863
>  # 16,1 (4)  Generic Group Length
> (160d,0000) ?? (UL) 3824301659\1114577058\3573223579\2679727550
>  # 16,1 (4)  Generic Group Length
> (160d,0001) ?? 43\4c\55\54\00\00\00\00\50\52\45\48\01\00\00\00\50\52\45\53\00\00\00\00\00\00\00\00\00\00\00\00
>        # 36,? (1)  Illegal Element
> (170d,0000) ?? (UL) 3850819895\1116855751\1080659125\3543366330
>  # 16,1 (4)  Generic Group Length
> ...
> 2. When quickly parsing the header, GDCM 1.x decide to skip private
> group, by using a deprecated mechanism: using private group length.
> 3. Because group length specified is trash, the DICOM parsing ends up early.
>
>
> A couple of solutions:
> 1. Use itkBooleanMacro(LoadPrivateTags) from the itk::GDCMImageIO and
> set it to On,
> 2. Use a more global solution for any instance of GDCMIOmageIO:
> LoadPrivateTagsDefaultOn(),
> 3. Switch to using GDCM 2.x (ITK_USE_SYSTEM_GDCM), which is a much
> more robust implementation of DICOM than GDCM 1.x,
> 4. Rewrite your image using gdcmconv 2.0.11 (not released):
>
>  gdcmconv  --remove-private-tags DicomInput.dcm out.dcm

Solution #5:

5. Use ITK CVS. For this very particular case of invalid group length
(when value is large enough that we seekg passed the eof), GDCM
properly handle that now:


$ cvs ci -m"ENH: detect when group length value is obviously wrong and
we are passed the eof. Reported by Hui Wang <cougarhui at yahoo.com>
on itk users."
/cvsroot/Insight/Insight/Utilities/gdcm/src/gdcmDocument.cxx,v  <--
src/gdcmDocument.cxx
new revision: 1.30; previous revision: 1.29


BTW, there was a typo in my email:

...
And tell them:
1. To actually read the DICOM PS 3.3-2007 standard, at least once in
their life (PS 3.5-2007, 7.2 Group Length)
2. Group elements are deprecated as of PS 3.3-2008.
...

I meant to say PS 3.5 (Part 5: Data Structures and Encoding). PS 3.3
does not describes what group length are...

-- 
Mathieu


More information about the Insight-users mailing list