[Insight-users] incorrect z-spacing in GDCM reading

Li, George (NIH/NCI) ligeorge at mail.nih.gov
Wed May 11 12:38:10 EDT 2005


Mathieu:

I cannot send the 2 images as attachment, because they are 205KB each.
I got a message from ITK, saying that there is limit of 40KB per mail
And my following mail was discarded.

Any other way I can send the images?

Thanks,

George



-----Original Message-----
From: Li, George (NIH/NCI) 
Sent: Wednesday, May 11, 2005 12:32 PM
To: 'Mathieu Malaterre'
Cc: 'Luis Ibanez'; insight-users at itk.org
Subject: RE: [Insight-users] incorrect z-spacing in GDCM reading


Thanks, Mathieu:

I have included two image slices, together with their header information, 
which is printed into text files from one of my own program. Actually, the 
dicom image files are generated from my program, too. Theoretically, the 
syntax should follow dicom3 definition on 'Image Position Patient' / 'Image 
Orientation Patient'. I did not check how GDCM parses the string.

The spacing should be 3.4mm, but GDCM got 1.00mm.

Look forward to hearing from you.

Thanks.

George


-----Original Message-----
From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com] 
Sent: Wednesday, May 11, 2005 12:00 PM
To: Li, George (NIH/NCI)
Cc: 'Luis Ibanez'; insight-users at itk.org
Subject: Re: [Insight-users] incorrect z-spacing in GDCM reading


George,

	Your code looks fine. The algorithm for finding the z spacing is
kind 
of tricky. So I am wondering if:

1. Your images might not have proper 'Image Position Patient' / 'Image 
Orientation Patient'

2. If they have, maybe gdcm is not able to parse the string properly.

Could it be possible that you send me at least two images from this 
dataset ?

If not, you'll have to turn the code to be more verbose in particular 
when entering the function:


     gdcm::SerieHelper::ImagePositionPatientOrdering

Thanks,
Mathieu

Li, George (NIH/NCI) wrote:
> Hi, Luis and ITK users:
>  
> I recently tried to adopt the GDCM dicom code for loading dicom series 
> images, and then consequently saving images in dicom series. However, 
> when I read the
> images, the spacing in z-direction is incorrect, leading to a compressed 
> image
> in z-direction. Here is the related code, could you help me to identify 
> anything
> wrong?
>  
> class CMDIDataITKIO
> {
>  public:
>   CMDIDataITKIO();
>   virtual ~CMDIDataITKIO();
>  public:
>   void ReadGDCM_DicomImages(const char*, SeriesReaderType::Pointer);
>   void WriteGDCM_DicomImages(const char*, ImageType::Pointer);
>  private:
>   // initiate in the ctor, and raise clean flag in dtor.
>   GDCMImageIOType::Pointer m_gdcmIO;
>   GDCMSeriesNames::Pointer m_gdcmNames;
>   SeriesReaderType::Pointer m_gdcmReader;
> }
>  
> 
> void CMDIDataITKIO::ReadGDCM_DicomImages(const char* folderName,
>                                                                        
> SeriesReaderType::Pointer reader)
> {
>  if(!m_gdcmIO) m_gdcmIO = GDCMImageIOType::New();
>  if(!m_gdcmNames) m_gdcmNames = GDCMSeriesNames::New();
>  
>  // Get the DICOM filenames from the directory
> m_gdcmNames->SetInputDirectory(folderName);
>  
>  reader->SetFileNames( m_gdcmNames->GetInputFileNames() );
> reader->SetImageIO( m_gdcmIO );
>  
>  try {
>   reader->Update();
>     }
>  catch (itk::ExceptionObject &excp) {
>   std::cerr << "Exception thrown while writing the image" << std::endl;
>   std::cerr << excp << std::endl;
>     }
> }
> Thanks,
>  
> George
>  
> 
> 
> ----------------------------------------------------------------------
> --
> 
> _______________________________________________
> 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