Thanks a lot... :) It works<br><br><div class="gmail_quote">2011/3/29 Abayiz <span dir="ltr"><<a href="mailto:abayiz@yahoo.com">abayiz@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit" valign="top">Hi,<br><br>For try the following partial code for reading your dicom series: <br>*********************************************************************<br>
typedef signed short PixelType;<br> const unsigned int Dimension = 3;<br> typedef itk::OrientedImage< PixelType, Dimension > ImageType;<div class="im"><br>typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>
</div><div class="im"> ReaderType::Pointer reader = ReaderType::New();<br></div> typedef itk::GDCMImageIO ImageIOType;<br> ImageIOType::Pointer dicomIO = ImageIOType::New(); <br> reader->SetImageIO( dicomIO );<br>
typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br> nameGenerator->SetUseSeriesDetails( true );<br> nameGenerator->AddSeriesRestriction("0008|0021" ); <br> nameGenerator->SetDirectory( argv[1] );<br>
try<br> {<br> <br> typedef std::vector< std::string > SeriesIdContainer; <br> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); <br> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>
SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br> while( seriesItr != seriesEnd )<br> {<br> std::cout << seriesItr->c_str() << std::endl;<br>
seriesItr++;<br> }<br> std::string seriesIdentifier;<br> if( argc > 3 ) <br> {<br> seriesIdentifier = argv[3];<br> }<br> else<br> {<br> seriesIdentifier = seriesUID.begin()->c_str();<br>
}<br> <br> typedef std::vector< std::string > FileNamesContainer;<br> FileNamesContainer fileNames; <br> fileNames = nameGenerator->GetFileNames( seriesIdentifier ); <br> reader->SetFileNames( fileNames );<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> }<br><br> catch (itk::ExceptionObject &ex)<br> {<br> std::cout << ex << std::endl;<br>
return EXIT_FAILURE;<br> }<br><br>--- On <b>Tue, 3/29/11, G G <i><<a href="mailto:greenlander1986@gmail.com" target="_blank">greenlander1986@gmail.com</a>></i></b> wrote:<br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px">
<br>From: G G <<a href="mailto:greenlander1986@gmail.com" target="_blank">greenlander1986@gmail.com</a>><br>Subject: Re: [Insight-users] dicom series read<br>To: "John Drescher" <<a href="mailto:drescherjm@gmail.com" target="_blank">drescherjm@gmail.com</a>><br>
Cc: "insight-users" <<a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>><br>Date: Tuesday, March 29, 2011, 4:12 AM<div><div></div><div class="h5"><br><br><div>I think yes, I open this dicom series in ITK-SNAP without
problems<br>When I use only \Examples\IO\DicomSeriesReadSeriesWrite.cxx<br>everything works fine, but when I use in my code it is wrong...<br><br><div>
2011/3/29 John Drescher <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=drescherjm@gmail.com" target="_blank">drescherjm@gmail.com</a>></span><br><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div><div></div><div>On Tue, Mar 29, 2011 at 3:21 AM, G G <<a rel="nofollow" href="http://mc/compose?to=greenlander1986@gmail.com" target="_blank">greenlander1986@gmail.com</a>> wrote:<br>
> Hi I have so problem with dicom series read...<br>
><br>
> I have this code for reading... I used this from<br>
> \Examples\IO\DicomSeriesReadSeriesWrite.cxx<br>
><br>
> typedef unsigned char /*signed short*/ PixelType;<br>
> const unsigned int InputDimension = 3;<br>
><br>
> typedef itk::Image< PixelType, InputDimension > ImageType;<br>
> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>
><br>
> typedef itk::GDCMImageIO ImageIOType;<br>
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
><br>
> ImageIOType::Pointer gdcmIO = ImageIOType::New();<br>
> NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>
><br>
> size_t found = path.find_last_of("/\\");<br>
> std::string str = path.substr(0,found);<br>
><br>
> namesGenerator->SetInputDirectory( str.c_str() );<br>
> const ReaderType::FileNamesContainer & filenames =<br>
> namesGenerator->GetInputFileNames();<br>
><br>
> ReaderType::Pointer reader = ReaderType::New();<br>
> reader->SetImageIO( gdcmIO );<br>
> reader->SetFileNames( filenames );<br>
><br>
> try<br>
> {<br>
> reader->Update();<br>
> }<br>
> catch (itk::ExceptionObject &e)<br>
> {<br>
> cerr << e << endl;<br>
> return;<br>
> }<br>
><br>
> typedef unsigned char /*signed short*/ /*float*/<br>
> PixelType2;<br>
> const unsigned int OutputDimension = 3;<br>
> typedef itk::Image< PixelType2, OutputDimension > OutputImageType;<br>
><br>
><br>
><br>
> typedef itk::ImageToVTKImageFilter< OutputImageType > ConnectorType;<br>
><br>
><br>
> ConnectorType::Pointer connector = ConnectorType::New();<br>
><br>
> connector->SetInput(reader->GetOutput());<br>
> // ... continue and display image in QvtkWidget<br>
><br>
> but when I am trying load dicom series I get this<br>
><br>
> WARNING: In ..\..\..\..\src\Insight\Code\IO\itkGDCMImageIO.cxx, line 348<br>
> GDCMImageIO (02B4A198): The DICOM file:<br>
> C:/InsightApplications-3.20.0/src/muj_test4/Release/neco2/image004.dcm does<br>
> not have a preamble.<br>
><br>
> Could someone help me please?<br>
> Thanks a lot<br>
><br>
<br>
</div></div>Does that file have 128 bytes before the DICM header?<br>
<br>
<a rel="nofollow" href="http://www.leadtools.com/SDK/medical/dicom-spec1.htm" target="_blank">http://www.leadtools.com/SDK/medical/dicom-spec1.htm</a><br>
<font color="#888888"><br>
John<br>
</font></blockquote></div><br>
</div><br></div></div>-----Inline Attachment Follows-----<br><br><div>_____________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><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>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>Please keep messages on-topic and check the ITK FAQ at:<br><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></blockquote></td></tr></tbody></table><br>
</blockquote></div><br>