[Insight-users] Writing new DICOM files.

Robert Haase robert_haase at gmx.de
Wed Nov 12 09:43:45 EST 2008


Hi Mathieu,

sorry for this. You're right there is such a function. But it doesn't do anything. It stores a bool value in KeepMediaStorageSOPClassUID. But no line of code cares about that value:

$ grep KeepMediaStorageSOPClassUID *
gdcmFileHelper.cxx:He has to use gdcm::FileHelper::SetKeepMediaStorageSOPClassUID(true)
gdcmFileHelper.cxx:   KeepMediaStorageSOPClassUID = false;
gdcmFileHelper.h:   void SetKeepMediaStorageSOPClassUID (bool v) 
gdcmFileHelper.h:                              { KeepMediaStorageSOPClassUID = v; }
gdcmFileHelper.h:   // no GetKeepMediaStorageSOPClassUID() method, on purpose!
gdcmFileHelper.h:   bool KeepMediaStorageSOPClassUID;

I wasn't sure if it is a bug or just a misunderstanding by me. My problem was, I opened some  MR DICOM Images, changed absolutly nothing and saved them to disc. After that, SIEMENS syngo software was no longer able to view the images in 3D-MPR view. So I checked, what happens to the DICOM tags and saw, that gdcm::FileHelper overwrites important tags:

0002,0002
0008,0008
0008,0016
(and some more)

Whatever I tried to change this behaviour didn't work (even the KeepMediaStorageSOPClassUID) and so I solved the problem in a pragmatic way. I don't know if the syngo-Software does implement the DICOM Standard in a correct way. But I'm quiet sure, that the images which leave my application have the same tag-quality like the ones who enter it. I'm actually not changing the SOP Class UID, I just wanted to keep the old one.

Regards,
Robert




-------- Original-Nachricht --------
> Datum: Wed, 12 Nov 2008 15:24:33 +0100
> Von: "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
> An: "Robert Haase" <robert_haase at gmx.de>
> CC: "Todd Jensen" <todd.jensen at ieee.org>, insight-users at itk.org
> Betreff: Re: [Insight-users] Writing new DICOM files.

> Robert,
> 
> On Wed, Nov 12, 2008 at 3:02 PM, Robert Haase <robert_haase at gmx.de> wrote:
> > Hi Todd,
> >
> > I had the same problem like you using ITK 3.8. The source documentation
> in utilities/gdcm/src/gdcmFileHelper.cxx (at line 356) tells us:
> >
> > --------------------------------------------------------
> > 4) When user *knows* he didn't modified the pixels, he may ask the
> writer to keep some
> > informations unchanged :
> > 'Media Storage SOP Class UID' (0x0002,0x0002)
> > 'SOP Class UID'               (0x0008,0x0016)
> > 'Image Type'                  (0x0008,0x0008)
> > 'Conversion Type'             (0x0008,0x0064)
> > He has to use gdcm::FileHelper::SetKeepMediaStorageSOPClassUID(true)
> > (probabely name has to be changed)
> > -------------------------------------------------------
> >
> > But this simply didn't work, because there is no function like
> SetKeepMediaStorageSOPClassUID.
> > Worse than no comment in source code is a wrong one.
> 
> Where did you look for the function ?
> 
> $ grep KeepMediaStorageSOPClassUID *
> ...
> gdcmFileHelper.h:   void SetKeepMediaStorageSOPClassUID (bool v)
> ...
> 
> It has been there for while now.
> 
> > I couldn't fix this problem in the itk/gdcm code because I'm a new
> ITK-user and not so familiar with coding rules.
> >
> > But I found a solution to get my program working (a dirty dirty
> workaround):
> >
> > I wrote my own MyFileHelper class, inheriting from gdcm::FileHelper.
> >
> > class GDCM_EXPORT MyFileHelper : public gdcm::FileHelper
> > {...}
> >
> > It has an overwritten function  Write(std::string const &fileName),
> which does NOT call CheckMandatoryElements(). So in this function I'm doing my
> own mandatory-checks and there I'm absolutly free in defining which tags
> should be changed and which not.
> >
> > To get this work, I also had to implement an own DicomIO, which uses
> MyFileHelper, not the gdcm one
> >
> > class ITK_EXPORT myDicomImageIO : public itk::GDCMImageIO
> > {...}
> >
> > Maybe this helps you. If you wish, I could send you my 'dirty'
> implementation of this.
> 
> CheckMandatoryElements is an important function to not try to bypass
> it. It is defined in the standard when & where you are allowed to
> preserve the UID. If you believe you found a case where you can
> preserve the UID but GDCM will not let you do it, please fill in a bug
> report.
> 
> 
> -- 
> Mathieu

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


More information about the Insight-users mailing list