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

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


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
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050511/209bead6/attachment.html


More information about the Insight-users mailing list