[Insight-users] Spacing and DICOM reader

Ivan Bricault Ivan.Bricault at imag.fr
Fri, 02 Apr 2004 02:06:16 -0500


Hi all,
I have had some troubles using ITK DICOM reader.
I am using ITK 1.4 so I don't know if something has changed in more 
recent ITK versions.

1/  In the file "itDICOMImageIO2.cxx", function "void 
DICOMImageIO2::ReadImageInformation()"
one can see:

"-----------------
  for (int i = 0; i < 2; i++)
    {
    this->SetOrigin(i, origin[i]);
    this->SetSpacing(i, spacing[i]);
    this->SetDimensions(i, dims[i]);
    }
---------------------"

Because the "for" loop stops at i=1, the "z" coordinate of the origin is 
not properly initialized - the same for z spacing.
This problem is solved with a "for (int i = 0; i < 3; i++)" loop.

2/ This second point appears to be completely independent of point 1/ above.

I wrote some code to read a series of DICOM CT files.
This first version explicitly specifies the use of the DICOMImageIO2 
reader.
It works perfectly; in particular, it sets the "z" spacing to the 
correct value, which is 5 for my data:

------------------------
#include "itkImageSeriesReader.h"
#include "itkDICOMImageIO2.h"

typedef ..... ImageType;
typedef itk::ImageSeriesReader<ImageType> SeriesReaderType;
typedef itk::DICOMImageIO2  DICOMReaderType;
SeriesReaderType::Pointer seriesReader = SeriesReaderType::New();
DICOMReaderType::Pointer DICOMreader = DICOMReaderType::New();

while (....)
{
     fileName = .....
     seriesReader->AddFileName(fileName);
}
seriesReader->SetImageIO(DICOMreader);
seriesReader->Update();
--------------------------

The same code WITHOUT the line "seriesReader->SetImageIO(DICOMreader);"
correctly reads the data, EXCEPT that the "z" spacing value is now 
incorrectly set to 1 instead of 5
("x" and "y" spacing values are still OK).
What may be the explanation for that ?
Thanks for your advices !