<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>itry to read a dicom series me too can you send me your cmakelists.txt file<br>i try to execute this program but i have this error when i debogue it:"DicomImageReadWrite.cxx<br>.\DicomImageReadWrite.cxx(8) : fatal error C1083: Impossible d'ouvrir le fichier include : 'itkImageFileReader.h' : No such file or directory" and i join my cmakefile <br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif<br><br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkRescaleIntensityImageFilter.h"<br>#include "itkGDCMImageIO.h"<br>#include <list><br>#include <fstream><br><br>int main( int argc, char* argv[] )<br>{if( argc < 5 )<br>
{<br> std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " DicomImage OutputDicomImage ";<br> std::cerr << " OutputImage RescaleDicomImage\n";<br> return EXIT_FAILURE;<br> }<br>typedef signed short InputPixelType;<br> const unsigned int InputDimension = 2;<br><br> typedef itk::Image< InputPixelType, InputDimension > InputImageType;<br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName( argv[1] );<br> typedef itk::GDCMImageIO ImageIOType;<br><br> ImageIOType::Pointer gdcmImageIO = ImageIOType::New();<br> <br> reader->SetImageIO( gdcmImageIO );<br> try<br>
{<br> reader->Update();<br> }<br> catch (itk::ExceptionObject & e)<br> {<br> std::cerr << "exception in file reader " << std::endl;<br> std::cerr << e << std::endl;<br> return EXIT_FAILURE;<br> }<br> typedef itk::ImageFileWriter< InputImageType > Writer1Type;<br><br> Writer1Type::Pointer writer1 = Writer1Type::New();<br><br> writer1->SetFileName( argv[2] );<br> writer1->SetInput( reader->GetOutput() );<br> writer1->SetImageIO( gdcmImageIO );<br> try<br> {<br> writer1->Update();<br> }<br> catch (itk::ExceptionObject & e)<br> {<br> std::cerr << "exception in file writer " << std::endl;<br> std::cerr
<< e << std::endl;<br> return EXIT_FAILURE;<br> }<br> typedef unsigned char WritePixelType;<br> <br> typedef itk::Image< WritePixelType, 2 > WriteImageType;<br> <br> typedef itk::RescaleIntensityImageFilter< <br> InputImageType, WriteImageType > RescaleFilterType;<br><br> RescaleFilterType::Pointer rescaler = RescaleFilterType::New();<br><br> rescaler->SetOutputMinimum( 0 );<br> rescaler->SetOutputMaximum( 255 );<br> typedef itk::ImageFileWriter< WriteImageType > Writer2Type;<br><br> Writer2Type::Pointer writer2 = Writer2Type::New();<br><br> writer2->SetFileName( argv[3] );<br> <br> rescaler->SetInput( reader->GetOutput() );<br> writer2->SetInput( rescaler->GetOutput() );<br>
try<br> {<br> writer2->Update();<br> }<br> catch (itk::ExceptionObject & e)<br> {<br> std::cerr << "exception in file writer " << std::endl;<br> std::cerr << e << std::endl;<br> return EXIT_FAILURE;<br> }<br> typedef itk::ImageFileWriter< WriteImageType > Writer3Type;<br> <br> Writer3Type::Pointer writer3 = Writer3Type::New();<br><br> writer3->SetFileName( argv[4] );<br> writer3->SetInput( rescaler->GetOutput() );<br> writer3->UseInputMetaDataDictionaryOff ();<br> writer3->SetImageIO( gdcmImageIO );<br> try<br> {<br> writer3->Update();<br> }<br> catch (itk::ExceptionObject & e)<br> {<br>
std::cerr << "Exception in file writer " << std::endl;<br> std::cerr << e << std::endl;<br> return EXIT_FAILURE;<br> return EXIT_SUCCESS;<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> Patrik.Br. <patrik.brynolfsson@gmail.com><br><b><span style="font-weight: bold;">À :</span></b> insight-users@itk.org<br><b><span style="font-weight: bold;">Envoyé le :</span></b> Mardi, 16 Juin 2009, 10h43mn 41s<br><b><span style="font-weight: bold;">Objet :</span></b> [Insight-users] Strange error when reading DICOM<br></font><br><br>Hello,<br><br>I am trying to read DICOM series from a folder, much like in example<br>DicomSeriesReadImageWrite2.cxx.
However, I modified the reader so that it<br>loops over all found series instead of just the first:<br><br>SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br>std::string seriesIdentifier;<br>typedef std::vector< std::string > FileNamesContainer;<br>FileNamesContainer fileNames;<br><br>while( seriesItr != seriesEnd )<br> {<br> seriesIdentifier = seriesItr->c_str();<br> fileNames = nameGenerator->GetFileNames( seriesIdentifier );<br> reader->SetFileNames( fileNames );<br> try{<br> reader->Update();<br> }<br> catch (itk::ExceptionObject &ex)<br> {<br> std::cout << ex <<
std::endl;<br> return EXIT_FAILURE;<br> }<br> <br> {<br> //Some code<br> }<br> <br> seriesItr++;<br> } <br><br>However I sometimes get the error <br>"Requested region is (at least partially) outside the largest possible<br>region."<br>I first thought this was due to one faulty DICOM series, but it happens for<br>many series, but not all of them. It only happens when I read multiple DICOM<br>series i.e. when I use the loop, never when I read just one series. Also,<br>depending on what other series have been read before, some series might or<br>might not be read correctly without error. What's going on?<br><br>-- <br>View this message in context: <a href="http://n2.nabble.com/Strange-error-when-reading-DICOM-tp3085364p3085364.html"
target="_blank">http://n2.nabble.com/Strange-error-when-reading-DICOM-tp3085364p3085364.html</a><br>Sent from the ITK Insight Users mailing list archive at Nabble.com.<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>