[Insight-users] Spacing and DICOM reader

Miller, James V (Research) millerjv at crd.ge.com
Mon, 5 Apr 2004 09:04:39 -0400


Ivan, 

I checked in the patches to DICOMImageIO2 last Friday.  They all passed the
Dashboard tests over the weekend.  A number of files were changed:
DICOMImageIO2, ImageSeriesReader, ImageFileReader, ... This checkin also
included some changes to the Print()/PrintSelf() methods.  So you might need
to update a number of other files in IO and Common. (Probably safest just to
update all of ITK).	

Jim



-----Original Message-----
From: Ivan Bricault [mailto:bricault at bwh.harvard.edu]
Sent: Sunday, April 04, 2004 8:45 PM
To: Miller, James V (Research)
Subject: Re: [Insight-users] Spacing and DICOM reader


Thanks for the change and these explanations !
Best,
   Ivan.


Miller, James V (Research) wrote:

>Ivan, 
>
>On the first point: A 2D DICOM file can have information in it that
>specifies where it lives in a 3D world.  But DICOMImageIO2 was only paying
>attention to the first two dimensions specified.  I am making a change now
>that will have the DICOMImageIO2 say a 2D image has a 3D position and 3D
>spacing. So these fields will be set.  Not that when reading a single DICOM
>image, the third component of the spacing will default to the slice
>thickness (if specified).  When an ImageSeriesReader is used to read a
DICOM
>series, the third component of spacing will be determined by the actual
>difference in position of two adjacent slices (which is can be different
>than the slice thickness). 
>
>I'll post another note when I check in these changes to the CVS repository.
>
>On the second point: After the ITK 1.4 release, DICOMImageIO2 was made the
>default DICOM reader.  So when you did not set the ImageIO object on the
>SeriesReader, the SeriesReader (via the factory mechanism) defaulted to
>using DICOMImageIO (and not DICOMImageIO2).  This explains why you had
>problems when you did not set the ImageIO object.  In ITK 1.6, you would
not
>need to set the ImageIO since the default is DICOMImageIO2.
>
>
>
>
>-----Original Message-----
>From: Ivan Bricault [mailto:Ivan.Bricault at imag.fr]
>Sent: Friday, April 02, 2004 2:06 AM
>To: insight-users at itk.org
>Subject: [Insight-users] Spacing and DICOM reader
>
>
>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 !
>
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>  
>