[Insight-users] Read series DICOM files by itkImageSeriesRead er

Lorensen, William E (Research) lorensen at crd . ge . com
Tue, 2 Sep 2003 07:11:29 -0400


You have declared the image to be 5 dimensional, not 3d. Is this what you
intended?

Bill

-----Original Message-----
From: jiang [mailto:jiang at TI . Uni-Trier . DE]
Sent: Thursday, August 28, 2003 10:35 AM
To: ITK
Subject: [Insight-users] Read series DICOM files by itkImageSeriesReader


Hello all,
I want to build 3d image volume by a serie of DICOM files. So I write the
following code according to the example
\Insight\Testing\Code\IO\itkDICOMImageSeriesTest.cxx

#include "itkDICOMImageIO2Factory.h"
#include "itkDICOMImageIO2.h"
#include "itkImageSeriesReader.h"
#include "itkDICOMSeriesFileNames.h"
#include "../Testing/Code/BasicFilters/itkFilterWatcher.h"

int main(int argc, char **argv)
{

  typedef itk::Image<unsigned short,5> ImageNDType;
  typedef itk::ImageSeriesReader<ImageNDType> ReaderType;
  ReaderType::Pointer reader = ReaderType::New();

 itk::DICOMImageIO2::Pointer io = itk::DICOMImageIO2::New();

  // Get the DICOM filenames from the directory
  itk::DICOMSeriesFileNames::Pointer names =
itk::DICOMSeriesFileNames::New();
  names->SetDirectory(s);//s is the directory path

  reader->SetFileNames(names->GetFileNames());
  reader->SetImageIO(io);
  std::cout << names;

  try
    {
    if (atoi(argv[2]))
      {
      reader->ReverseOrderOn();
      }
    reader->Update();
    reader->GetOutput()->Print(std::cout);
    }
  catch (itk::ExceptionObject &ex)
    {
    std::cout << ex;
    return EXIT_FAILURE;
    }


	return EXIT_SUCCESS;
}


However this code can not work. I debug it and find that most codes are
correct. But the program stops at reader->Update();
What is the problem? How can I realize the series DICOM files reading?
I use the latest ITK tarball.



Thanks!


Chunyan

_______________________________________________
Insight-users mailing list
Insight-users at itk . org
http://www . itk . org/mailman/listinfo/insight-users