[Insight-developers] DICOM series

Bill Lorensen bill.lorensen at gmail.com
Thu Nov 22 13:53:47 EST 2007


Ivan,
 This seems to be a vtk question. In the future, please post questions like
this to 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.

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> 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
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20071122/f126bccd/attachment.html


More information about the Insight-developers mailing list