[Insight-users] Problem Reading DICOM Image Series

Antonio Gómez Barquero agb1 at alu.upct.es
Wed Dec 14 04:17:30 EST 2011


	
Sorry for not answering, but I was forced to finish some work with a near deadline!

Now, I know where is the error, is in the last line of these:

	std::string seriesIdentifier;
	seriesIdentifier = seriesUID.begin()->c_str();
	FileNamesContainer fileNames;

	fileNames = nameGenerator->GetFileNames( seriesIdentifier ); <--- HERE IS THE ERROR

It goes with the iterator through all the dicom image series I have in the folder, but when it reaches the filename, it write in this variable, the direction of the 92º image! Why can be that?

Because of that, only one 2D image is read, not the whole 3D volume.

Thanks again!

Antonio



-----Mensaje original-----
De: wilf.rosenbaum at gmail.com [mailto:wilf.rosenbaum at gmail.com] 
Enviado el: martes, 29 de noviembre de 2011 16:10
Para: Antonio Gómez Barquero
CC: Bill Lorensen; insight-users at itk.org
Asunto: Re: [Insight-users] Problem Reading DICOM Image Series

Your code looks fine ( and sounds like it is running fine) to me. SeriesEnd should be an invalid value - it is used it indicate that you have iterated over the entire string. Does your program run ok? What do you expect seriesEnd to contain?



On Nov 29, 2011, at 5:19 AM, Antonio Gómez Barquero <agb1 at alu.upct.es> wrote:

> 
> Thanks for your reply, I changed it and is not working, I have the 
> same problem , which is that  'SeriesIdContainer::const_iterator 
> seriesEnd = seriesUID.end();'  is returning a null pointer.
> 
> Thanks Bill!
> 
> Antonio
> 
> -----Mensaje original-----
> De: Bill Lorensen [mailto:bill.lorensen at gmail.com] Enviado el: martes, 
> 29 de noviembre de 2011 14:12
> Para: Antonio Gómez Barquero
> CC: insight-users at itk.org
> Asunto: Re: [Insight-users] Problem Reading DICOM Image Series
> 
> You should be using
> ++seriesItr;
> 
> and not
> 
> seriesItr++;
> 
> 2011/11/29 Antonio Gómez Barquero <agb1 at alu.upct.es>:
>> 
>> 
>> Hello all,
>> 
>> 
>> 
>> I want to read a Series of DICOM image to convert them into a 3D 
>> image. I follow the example in the documentation: "
>> Examples/IO/DicomSeriesReadImageWrite2.cxx" . But I am still having 
>> problems, I solved some, but I would like to hear any tip, please!
>> 
>> The problem is in line code line underlined with red color and the 
>> code is just below her and it’s not so long. It compiles, and the 
>> variable ‘seriesItr’ has the value = 
>> "1.2.392.200036.9116.2.6.1.48.1214834239.1284941923.42443543.0512512"
>> . But the variable ‘seriesEnd’ is a null pointer! What am I doing 
>> wrong?  Thanks for your help in advanced!
>> 
>> // Reading a 2D DICOM Series and Writing a Volume
>> 
>>       ReaderType::Pointer reader = ReaderType::New();
>> 
>> 
>> 
>>       ImageIOType::Pointer dicomIO = ImageIOType::New();
>> 
>>       reader->SetImageIO( dicomIO );
>> 
>>       NamesGeneratorType::Pointer nameGenerator = 
>> NamesGeneratorType::New();
>> 
>> nameGenerator->SetUseSeriesDetails( true );
>> 
>> 
>> 
>>       std::string folder;
>> 
>>       folder = "C:\\Documents and Settings\\GTTS\\Mis 
>> documentos\\Visual Studio 
>> 2008\\Projects\\Reg_mono3D\\Reg_mono3D\\DICOM_SERIES\\T\\";
>> 
>>       nameGenerator->SetDirectory(folder);
>> 
>> 
>> 
>>       const SeriesIdContainer & seriesUID =
>> nameGenerator->GetSeriesUIDs();
>> 
>>       SeriesIdContainer::const_iterator seriesItr = 
>> seriesUID.begin();
>> 
>>       SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
>> 
>>       while( seriesItr != seriesEnd )
>> 
>>       {
>> 
>>             std::cout << seriesItr->c_str() << std::endl;
>> 
>>             seriesItr++;
>> 
>>       }
>> 
>> 
>> 
>>       std::string seriesIdentifier;
>> 
>>       seriesIdentifier = seriesUID.begin()->c_str();
>> 
>>       FileNamesContainer fileNames;
>> 
>>       fileNames = nameGenerator->GetFileNames( seriesIdentifier );
>> 
>> 
>> 
>>       reader->SetFileNames( fileNames );
>> 
>> 
>> 
>>       try
>> 
>>       {
>> 
>>             reader->Update();
>> 
>>       }
>> 
>>       catch (itk::ExceptionObject &ex)
>> 
>>       {
>> 
>>             cout << ex << std::endl;
>> 
>>       }
>> 
>> 
>> 
>> Antonio Gómez Barquero
>> 
>> 
>> 
>> Ingeniero de Telecomunicaciones -Becario Investigador asociado a 
>> Actividades de I+D+I
>> 
>> GTTS ( Grupo de Tratamiento y Teoría de la Señal)[ 
>> http://gtts.upct.es/]
>> 
>> UPCT (Universidad Politécnica de Cartagena)[ http://www.upct.es/]
>> 
>> 
>> 
>> 
>> _____________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>> 
> 
> 
> 
> --
> Unpaid intern in BillsBasement at noware dot com
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list