[Insight-developers] DICOM series

ivan gm ivan.gm.itk at gmail.com
Thu Nov 22 13:20:08 EST 2007


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


More information about the Insight-developers mailing list