[vtkusers] Re: [Insight-users] Re: [Insight-developers] DICOM series

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Thu Nov 22 14:16:13 EST 2007


Bill Lorensen wrote:
> Ivan,
>  This seems to be a vtk question. In the future, please post questions 
> like this to vtk-users at vtk.org <mailto:vtk-users at vtk.org>.
>
> I notice you are using the vtkDICOMImageReader. itk has much better 
> support for DICOM than vtk. In itk, your can use the 
> itkGDCMSeriesFilenames class to get the list of files in multiple 
> dicom series. Also, the itk dicom reader based on GDCM is a robust, 
> full featured reader.
> A dicom filename has nothing to do with the ordering of images in a 
> series. The position information is stored within the file itself. It 
> may be that your files always are named with a numerical suffix that 
> corresponds to the order of the images, but this is not in general 
> true, nor guaranteed.
> If you are using vtk, you will have to retrieve the 
> ImagePositionPatient for each file and sort the file names accordingly.
That's right.
But, if you want to go on using vtk only (and not ITK), you can download 
GDCM, that comes with a vtkGdcmReader, and use the gdcm::SerieHelper, 
that allows you task for file sorting, and them reading the whole file 
set into a single vtkImageData.

http://www.creatis.univ-lyon1.fr/Public/Gdcm

Jean-Pierre Roux
> Your real question I think will be best answered by the vtkusers list.
>
> Bill
>
> On Nov 22, 2007 1:20 PM, ivan gm <ivan.gm.itk at gmail.com 
> <mailto:ivan.gm.itk at gmail.com>> wrote:
>
>     Hello:
>      
>     I'm trying to show images with C++ in an MFC GUI. I have 79 images
>     to read in DICOM format, nowadays I'm reading each image separate
>     with a vtkDICOMImageReader with this code:
>      
>     std::string path = cFileDialog.GetPathName();
>     std::string file = cFileDialog.GetFileName();
>     path = path.erase(path.rfind(file),file.length());
>     this->readerDirectory = path;
>     this->nameGenerator->SetDirectory( path.c_str());
>     this->nameGenerator->SetFileNameSortingOrderToSortByImageNumber();
>     this->fileNames = this->nameGenerator->GetFileNames();
>     // read new data
>     n_value = 0;
>     if (!this->pvtkDICOMReader)
>     this->pvtkDICOMReader = vtkDICOMImageReader::New();
>     this->pvtkDICOMReader->SetFileName(this->fileNames[n_value].c_str());
>      
>     After that, I show the image in my form with this code:
>      
>             this->pvtkDICOMReader->Update();
>            
>     this->pvtkImageMapper->SetInput(this->pvtkDICOMReader->GetOutput());
>             this->pvtkImageMapper->SetColorWindow(8192);
>             this->pvtkImageMapper->SetColorLevel(128);
>             this->pvtkActor2D->SetMapper(this->pvtkImageMapper);
>             this->pvtkRenderer->AddActor(this->pvtkActor2D);
>      
>     I read the first image showing it in the form and when i push a
>     button I read the second and then the third... It runs perfectly
>     but what I want to do is to read all my 79 images with the
>     vtkDICOMImageReader and after that show the image with an index
>     number from 0 to 78 as an example. I don't know how to do that and
>     if it is possible. Do you have any suggestions?
>      
>     Thanks a lot and
>     sorry for my English.
>
>     _______________________________________________
>     Insight-developers mailing list
>     Insight-developers at itk.org <mailto:Insight-developers at itk.org>
>     http://www.itk.org/mailman/listinfo/insight-developers
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>   



More information about the vtkusers mailing list