<div dir="ltr"><div>I am relatively new to ITK and VTK. I am trying to read a DICOM series into ITK and i want to visualize it with VTK .</div><div><br></div><div>the following code allows to read a DICOM series with success, now i want to visualize it with vtk.</div>
<div><br></div><div>int main( int argc, char* argv[] )</div><div>{</div><div>typedef unsigned short PixelType;</div><div> const unsigned int Dimension = 3;</div><div> typedef itk::Image< PixelType, Dimension > ImageType;</div>
<div><br></div><div>typedef itk::ImageSeriesReader< ImageType > ReaderType;</div><div> ReaderType::Pointer reader = ReaderType::New();</div><div> typedef itk::GDCMImageIO ImageIOType;</div><div> ImageIOType::Pointer dicomIO = ImageIOType::New(); </div>
<div> reader->SetImageIO( dicomIO );</div><div> typedef itk::GDCMSeriesFileNames NamesGeneratorType;</div><div> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();</div><div> nameGenerator->SetUseSeriesDetails( true );</div>
<div> nameGenerator->AddSeriesRestriction("0008|0021" ); </div><div> nameGenerator->SetDirectory( "C:/Lab/VersionEssaies/MCVS2008Test/DICOM/digest_article" );</div><div> try</div><div> {</div>
<div> </div><div> typedef std::vector< std::string > SeriesIdContainer; </div><div> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); </div><div><span class="" style="white-space:pre">        </span>std::cout << seriesUID.size() << std::endl;</div>
<div> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();</div><div> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();</div><div> while( seriesItr != seriesEnd )</div><div> {</div><div>
std::cout << seriesItr->c_str() << std::endl;</div><div> seriesItr++;</div><div> }</div><div> std::string seriesIdentifier;</div><div> if( argc > 3 ) </div><div> {</div><div> seriesIdentifier = argv[3];</div>
<div> }</div><div> else</div><div> {</div><div> seriesIdentifier = seriesUID.begin()->c_str();</div><div> }</div><div> </div><div><span class="" style="white-space:pre">        </span>std::cout << seriesIdentifier.c_str() << std::endl;</div>
<div><br></div><div> typedef std::vector< std::string > FileNamesContainer;</div><div> FileNamesContainer fileNames; </div><div> fileNames = nameGenerator->GetFileNames( seriesIdentifier ); </div><div>
reader->SetFileNames( fileNames );</div><div> try</div><div> {</div><div> reader->Update();</div><div><span class="" style="white-space:pre">        </span> </div><div><br></div><div> }</div><div> catch (itk::ExceptionObject &ex)</div>
<div> {</div><div> std::cout << ex << std::endl;</div><div> return EXIT_FAILURE;</div><div> }</div><div> }</div><div><br></div><div> catch (itk::ExceptionObject &ex)</div><div> {</div>
<div> std::cout << ex << std::endl;</div><div> return EXIT_FAILURE;</div><div> }</div><div><br></div><div> </div><div> return EXIT_SUCCESS;</div><div>}</div><div><br></div><div>If anyone has an example that does what i am trying to do </div>
<div> please let me know. I would really appreciate it. </div><div>Thanks in advance.</div><div><br></div></div>