<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>this is my code and you must verify your cmake file<br>#include "itkImageSeriesReader.h"<br>#include "itkDICOMImageIO2.h"<br>#include "itkDICOMSeriesFileNames.h"<br>#include "itkImageFileWriter.h"<br><br>int main( int argc, char* argv[] )<br>{<br>/*<br> if( argc < 3 )<br> {<br> std::cerr << "Usage: " << argv[0] << " DicomDirectory outputFileName [seriesName]" << std::endl;<br> return EXIT_FAILURE;<br> }<br>*/<br><br> argc = 2;<br> argv[1] = "dicom";<br> argv[2] = "dicomMRA.hdr";<br> <br> typedef itk::Image<short,3>
ImageType;<br> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br><br> itk::DICOMImageIO2::Pointer dicomIO = itk::DICOMImageIO2::New();<br><br> // Get the DICOM filenames from the directory<br> itk::DICOMSeriesFileNames::Pointer nameGenerator = itk::DICOMSeriesFileNames::New();<br> nameGenerator->SetDirectory( argv[1] );<br> <br><br> try<br> {<br> typedef std::vector<std::string> seriesIdContainer;<br> const seriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<br><br> seriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br> seriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br> <br> std::cout << std::endl << "The directory: " << std::endl;<br> std::cout << std::endl
<< argv[1] << std::endl << std::endl;<br> std::cout << "Contains the following DICOM Series: ";<br> std::cout << std::endl << std::endl;<br><br> while( seriesItr != seriesEnd )<br> {<br> std::cout << seriesItr->c_str() << std::endl;<br> seriesItr++;<br> }<br> <br> std::cout << std::endl << std::endl;<br> std::cout << "Now reading series: " << std::endl << std::endl;<br><br> typedef std::vector<std::string> fileNamesContainer;<br> fileNamesContainer fileNames;<br><br> if( argc < 4 ) // If no optional third argument<br> {<br> std::cout
<< seriesUID.begin()->c_str() << std::endl;<br> fileNames = nameGenerator->GetFileNames();<br> }<br> else<br> {<br> std::cout << argv[3] << std::endl;<br> fileNames = nameGenerator->GetFileNames( argv[3] );<br> }<br> std::cout << std::endl << std::endl;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileNames( fileNames );<br> reader->SetImageIO( dicomIO );<br><br> try<br> {<br> reader->Update();<br> }<br> catch (itk::ExceptionObject &ex)<br>
{<br> std::cout << ex << std::endl;<br> return EXIT_FAILURE;<br> }<br><br> typedef itk::ImageFileWriter< ImageType > WriterType;<br> WriterType::Pointer writer = WriterType::New();<br><br> std::cout << "Writing the image as " << std::endl << std::endl;<br> std::cout << argv[2] << std::endl << std::endl;<br><br> writer->SetFileName( argv[2] );<br> <br> writer->SetInput( reader->GetOutput() );<br><br> try<br> {<br> writer->Update();<br> }<br> catch (itk::ExceptionObject &ex)<br>
{<br> std::cout << ex;<br> return EXIT_FAILURE;<br> }<br> }<br> catch (itk::ExceptionObject &ex)<br> {<br> std::cout << ex;<br> return EXIT_FAILURE;<br> }<br><br> return EXIT_SUCCESS;<br><br>}<br><br>i hope that will help you. tell wether your program goes on or not<br><br><br><br><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">De :</span></b> Ezequiel Geremia <t-egerem@microsoft.com><br><b><span style="font-weight: bold;">À :</span></b> Mathieu Malaterre <mathieu.malaterre@gmail.com><br><b><span style="font-weight: bold;">Cc :</span></b>
"insight-users@itk.org" <insight-users@itk.org><br><b><span style="font-weight: bold;">Envoyé le :</span></b> Mardi, 23 Juin 2009, 16h18mn 52s<br><b><span style="font-weight: bold;">Objet :</span></b> Re: [Insight-users] Output dicom series in new directory<br></font><br>No exception is thrown. The output dicom series are not created in the requested Directory.<br><br>Moreover Syrine, there is not a matter of reading nrrd format, it is just a matter of outputting generated files in the right directory.<br><br>If already have had that problem and resolve it you can send me the file so that I can compare it with mine. It will help me solving that issue.<br><br>Thanks,<br><br>Ezequiel<br><br>-----Original Message-----<br>From: Mathieu Malaterre [mailto:<a ymailto="mailto:mathieu.malaterre@gmail.com" href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>] <br>Sent: 23 June 2009 16:11<br>To: Ezequiel Geremia<br>Cc: <a
ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>Subject: Re: [Insight-users] Output dicom series in new directory<br><br>On Tue, Jun 23, 2009 at 4:45 PM, Ezequiel Geremia<<a ymailto="mailto:t-egerem@microsoft.com" href="mailto:t-egerem@microsoft.com">t-egerem@microsoft.com</a>> wrote:<br>> Hi insight-users,<br>><br>> I wrote a code inspired from itkSoftwraeGuide to convert nrrd files into dicom series.<br>><br>> When running the executable on windows vista, the latter does not output the dicom slices in the directory specified through<br>><br>> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>> NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>><br>> namesGenerator->SetOutputDirectory( outputDirectory );<br>><br>> Do you have an idea on how to resolve that issue ?<br><br>I have absolutely no idea. But if you send the
output of the<br>executable, I might help. just print the exception that's thrown<br>during the call to Update() (or Write()) and send it to the list.<br><br>2cts<br><br>-- <br>Mathieu<br><br>_____________________________________<br><span>Powered by <a target="_blank" href="http://www.kitware.com">www.kitware.com</a></span><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br></div></div></div><br>
</body></html>