<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><div style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: rgb(0, 0, 0);"><div>Hi,<br>I send again the same mail because i need help really.<br>i
try to apply a discrete gaussian filter on a serie of 3D dicom
images.so i try to do what Luis said to me to read the dicom serie
before and then add the discrete gaussian filter. the code that i wrote
is the follwing, please can you help me toi correct it. really i need
help.<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><br>#include "itkOrientedImage.h"<br>#include "itkGDCMImageIO.h"<br>#include "itkGDCMSeriesFileNames.h"<br>#include "itkImageSeriesReader.h"<br>#include "itkImageFileWriter.h"<br><br><br>#include "itkRescaleIntensityImageFilter.h"<br>#include "itkDiscreteGaussianImageFilter.h"<br><br><br>int main( int argc, char* argv[] )<br>{<br><br> /* if( argc
< 3 )<br> {<br> std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " DicomDirectory outputFileName [seriesName]" << std::endl;<br> return EXIT_FAILURE;<br> }<br><br>*/<br><br> argc = 2;<br> argv[1] = "dicom";<br> argv[2] = "dicomMRA.hdr";<br> typedef signed short PixelType;<br> const unsigned int Dimension = 3;<br><br> typedef itk::OrientedImage< PixelType, Dimension > ImageType;<br><br> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br> ReaderType::Pointer reader = ReaderType::New();<br><br> typedef itk::GDCMImageIO
ImageIOType;<br> ImageIOType::Pointer dicomIO = ImageIOType::New();<br> <br> reader->SetImageIO( dicomIO );<br><br> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br><br> nameGenerator->SetUseSeriesDetails( true );<br> nameGenerator->AddSeriesRestriction("0008|0021" );<br> <br> nameGenerator->SetDirectory( argv[1] );<br><br> <br><br> try<br> {<br> std::cout << std::endl << "The directory: " << std::endl;<br> std::cout << std::endl << argv[1] << std::endl ;<br> std::cout << "Contains the following DICOM Series: ";<br> std::cout << std::endl << std::endl;<br><br><br><br> typedef std::vector< std::string >
SeriesIdContainer;<br> <br> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<br> <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><br><br> std::string seriesIdentifier;<br><br> if( argc > 3 ) // If no optional series identifier<br> {<br> seriesIdentifier = argv[3];<br> }<br> else<br>
{<br> seriesIdentifier = seriesUID.begin()->c_str();<br> }<br><br><br><br> std::cout << std::endl << std::endl;<br> std::cout << "Now reading series: " << std::endl << std::endl;<br> std::cout << seriesIdentifier << std::endl;<br> std::cout << std::endl << std::endl;<br><br><br><br><br><br> typedef std::vector< std::string > FileNamesContainer;<br> FileNamesContainer fileNames;<br><br> fileNames = nameGenerator->GetFileNames( seriesIdentifier );<br><br> reader->SetFileNames( fileNames );<br><br><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><br>}<br> catch (itk::ExceptionObject &ex)<br> {<br> std::cout << ex << std::endl;<br> return EXIT_FAILURE;<br> }<br><br>typedef itk::DiscreteGaussianImageFilter<<br> InputImageType, OutputImageType > FilterType;<br><br> FilterType::Pointer filter = FilterType::New();<br> filter->SetInput( reader->GetOutput() );<br><br>const double gaussianVariance = atof( argv[3] );<br> const unsigned int maxKernelWidth = atoi( argv[4] );<br> filter->SetVariance( gaussianVariance );<br>
filter->SetMaximumKernelWidth( maxKernelWidth );<br> filter->Update();<br><br><br> typedef unsigned char WritePixelType;<br> typedef itk::Image< WritePixelType, 2 > WriteImageType;<br> typedef itk::RescaleIntensityImageFilter< <br> OutputImageType, WriteImageType > RescaleFilterType;<br> RescaleFilterType::Pointer rescaler = RescaleFilterType::New();<br><br> rescaler->SetOutputMinimum( 0 );<br> rescaler->SetOutputMaximum( 255 );<br><br> typedef itk::ImageFileWriter< WriteImageType > WriterType;<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName( argv[2] );<br> rescaler->SetInput( filter->GetOutput() );<br> writer->SetInput( rescaler->GetOutput() );<br> writer->Update();<br> return
EXIT_SUCCESS;<br><br>}<br> thanks to all<br></div></div></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> John Drescher <drescherjm@gmail.com><br><b><span style="font-weight: bold;">À :</span></b> Syrine Sahmim <syrine.sahmim@yahoo.fr>; Insight Users <insight-users@itk.org><br><b><span style="font-weight: bold;">Envoyé le :</span></b> Lundi, 3 Août 2009, 12h03mn 30s<br><b><span style="font-weight: bold;">Objet :</span></b> Re: [Insight-users] Re : Re : Re : Re : Re : trying examples<br></font><br>On Mon, Aug 3, 2009 at 6:51 AM, Syrine Sahmim<<a ymailto="mailto:syrine.sahmim@yahoo.fr" href="mailto:syrine.sahmim@yahoo.fr">syrine.sahmim@yahoo.fr</a>> wrote:<br>> Where exactly
please?<br>><br><br>Looks like the recommendation was DicomImageViewer<br><br><a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/DicomImageViewer/?root=InsightApplications" target="_blank">http://public.kitware.com/cgi-bin/viewcvs.cgi/DicomImageViewer/?root=InsightApplications</a><br><br>from InsightApplications.<br><br><br>This is a separate download from itk.<br><br><br><a href="http://itk.org/ITK/resources/software.html" target="_blank">http://itk.org/ITK/resources/software.html</a><br><br><br><br>John<br></div></div></div><br>
</body></html>