[Insight-users] Displaying series of DICOM Images
Luis Ibanez
luis . ibanez at kitware . com
Thu, 25 Sep 2003 01:46:34 -0400
Hi Thimmaiah,
Please look at :
Insight/Testing/Code/IO/itkDICOMImageSeriesTest.cxx
it looks like
#include "itkDICOMImageIO2Factory.h"
#include "itkDICOMImageIO2.h"
#include "itkImageSeriesReader.h"
#include "itkDICOMSeriesFileNames.h"
int itkDICOMImageSeriesTest(int ac, char* av[])
{
typedef itk::Image<unsigned short,3> ImageNDType;
typedef itk::ImageSeriesReader<ImageNDType> ReaderType;
itk::DICOMImageIO2::Pointer io = itk::DICOMImageIO2::New();
// Get the DICOM filenames from the directory
itk::DICOMSeriesFileNames::Pointer names =
itk::DICOMSeriesFileNames::New();
names->SetDirectory(av[1]); // command line argument = directory
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileNames( names->GetFileNames() );
reader->SetImageIO( io );
std::cout << names;
try
{
reader->Update();
reader->GetOutput()->Print( std::cout );
}
catch (itk::ExceptionObject &ex)
{
std::cout << ex;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Once you read the DICOM slices into ITK, you can
use the ITK to VTK filter adaptors availablein
InsightApplications/Auxiliary/vtk/
itkImageToVTKImage.h and .txx
this one converts an itk::Image into a vtkImageData,
that you can pass to a vtkImageViewer2 for visualization.
http://www . vtk . org/doc/nightly/html/classvtkImageViewer2 . html
For choosing a directory from a GUI you can use
The File_Chooser in FLTK
http://www . fltk . org/documentation . php/doc-1 . 1/functions . html#fl_dir_chooser
or QFileDialog in Qt
http://doc . trolltech . com/3 . 0/qfiledialog . html
or CFileDialog in MFC
http://msdn . microsoft . com/library/default . asp?url=/library/en-us/vclib/html/_MFC_CFileDialog . asp
or....
myProgram myDirectory
in the command line :-)
Regards,
Luis
-------------------------
Thimmaiah, Sandhya wrote:
> Hi,
> I wanted to know if anybody was able to display a series of 2D Dicom images.
> According to what I have seen in fltk, qtITK..they read a filename. I wanted
> to know if there is a way of choosing a directory and then giving the
> directory name to series reader to read all the dicom images in that
> directory. I would really appreciate if anyone can let me know a way to
> select a directory in a user interface. Thank you
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>