<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<FONT color=#008000 size=2><FONT color=#008000 size=2>
<FONT color=#000000>Hi, </FONT><BR>
<FONT color=#000000>I'm Roberta and I'm an biomedical engineer and a unskilled itk user. I have to converter and write an 3D image in a DICOM series. I' m following the itk guide exsamples. Even if the code compiles, the writing isn' t done. I wrote the following code, it's only a method in a project not implemented by me. I olso added the necessary typedef to understand the problem.</FONT><BR>
<FONT color=#000000>I'm waiting for useful informations.</FONT><BR>
<FONT color=#000000>Thank you for availability.</FONT><BR>
<FONT color=#000000>(I'm sorry for my english and for my computer science knowledge).</FONT><BR>
<FONT color=#000000></FONT> <BR><FONT color=#000000><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
#define</FONT></FONT><FONT size=2> DataType </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>unsigned</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>short</FONT></FONT><FONT size=2> <BR></FONT></FONT>
<FONT color=#000000></FONT> <BR><FONT color=#000000><FONT size=2><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
class</FONT></FONT><FONT size=2> MbElementConverter <BR>
{ <BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2>: <BR></FONT><FONT size=2>
</FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//Itk Input Image<BR></FONT></FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> Image <DataType , 3 > DataImageType;</FONT><BR>
<FONT size=2>.........<BR></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT>
<FONT color=#0000ff></FONT> <BR><FONT color=#0000ff><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
class</FONT></FONT><FONT color=#000000 size=2> MbDifference : </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2><FONT color=#000000> MbProgrammableAlgo</FONT><BR>
{<BR></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
protected</FONT></FONT><FONT size=2><FONT color=#000000>:</FONT><BR></FONT></FONT>
<FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>unsigned</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>short</FONT></FONT><FONT size=2> PixelType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::Image< PixelType, Dimension2 > ImageType2D;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::Image< </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>float</FONT></FONT><FONT size=2>, Dimension3 > ImageType3DF;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> MbElementConverter::DataImageType ImageType3D; <BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> MbElementConverter::DataImageType FixedImageType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> MbElementConverter::DataImageType MovingImageType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::ImageFileWriter< ImageType3D > WriterType3D;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::ImageSeriesWriter<ImageType3D, ImageType2D > SeriesWriterType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::ImageSeriesReader< ImageType3D > ReaderType3D;<BR></FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> OrientImageFilter<ImageType3D,ImageType3D> ImageOrienter;<BR></FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::GDCMImageIO GDCMImageIOType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::GDCMSeriesFileNames NamesGeneratorType;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::NumericSeriesFileNames NamesGeneratorType2;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> std::vector< std::string > SeriesIdContainer;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> std::vector< std::string > FileNamesContainer;<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> OrientImageFilter<ImageType3D,ImageType3D> tOrienter;</FONT><BR>
<FONT size=2>..........<BR>
</FONT> </FONT><BR>
<BR>
<BR>
<FONT color=#000000>void MbDifference::writeImageDICOM(char* outputDirectory, ImageType3D::Pointer inputImage)</FONT><BR>
<FONT color=#000000>{</FONT><BR>
<FONT color=#000000> itksys::SystemTools::MakeDirectory(outputDirectory);</FONT><BR>
<FONT color=#000000> GDCMImageIOType::Pointer gdcmIO = GDCMImageIOType::New();</FONT><BR>
<FONT color=#000000> SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();</FONT><BR>
<FONT color=#000000> NamesGeneratorType2::Pointer nameGenerator = NamesGeneratorType2::New();</FONT><BR>
<FONT color=#000000> FileNamesContainer fileNames;</FONT><BR>
<FONT color=#000000> std::string format = outputDirectory;</FONT><BR>
<FONT color=#000000> format += "/%08d";</FONT><BR>
<FONT color=#000000> // format += "dicom"; // filename extension</FONT><BR>
<FONT color=#000000> nameGenerator->SetSeriesFormat( format.c_str() );</FONT><BR>
<FONT color=#000000> ImageType3D::RegionType region = inputImage->GetLargestPossibleRegion();</FONT><BR>
<FONT color=#000000> ImageType3D::IndexType start = region.GetIndex(); </FONT><BR>
<FONT color=#000000> ImageType3D::SizeType size = region.GetSize(); </FONT><BR>
<FONT color=#000000> const unsigned int firstSlice = start[2];</FONT><BR>
<FONT color=#000000> const unsigned int lastSlice = start[2] + size[2] - 1;</FONT><BR>
<FONT color=#000000> nameGenerator->SetStartIndex( firstSlice );</FONT><BR>
<FONT color=#000000> nameGenerator->SetEndIndex( lastSlice );</FONT><BR>
<FONT color=#000000> nameGenerator->SetIncrementIndex( 1 );</FONT><BR>
<FONT color=#000000> fileNames = nameGenerator->GetFileNames();</FONT><BR>
<BR>
<FONT color=#000000>seriesWriter->SetFileNames( nameGenerator->GetFileNames() );</FONT><BR>
<FONT color=#000000> seriesWriter->SetInput( inputImage );</FONT><BR>
<FONT color=#000000> gdcmIO->LoadPrivateTagsOn();</FONT><BR>
<FONT color=#000000> gdcmIO->GetLoadPrivateTags();</FONT><BR>
<FONT color=#000000> gdcmIO->KeepOriginalUIDOn();</FONT><BR>
<FONT color=#000000> seriesWriter->SetImageIO( gdcmIO );</FONT><BR>
<FONT color=#000000> // seriesWriter->SetMetaDataDictionaryArray(reader->GetMetaDataDictionaryArray());</FONT><BR>
<FONT color=#000000> try</FONT><BR>
<FONT color=#000000> {</FONT><BR>
<FONT color=#000000> seriesWriter->Update();</FONT><BR>
<FONT color=#000000> }</FONT><BR>
<FONT color=#000000> catch( itk::ExceptionObject & excp )</FONT><BR>
<FONT color=#000000> {</FONT><BR>
<FONT color=#000000> std::cerr << "Exception thrown while writing the series " << std::endl;</FONT><BR>
<FONT color=#000000> </FONT><BR>
<FONT color=#000000> std::cerr << excp << std::endl;</FONT><BR>
<FONT color=#000000> }</FONT><BR>
<FONT color=#000000>}</FONT><BR></FONT></FONT>                                            <br /><hr />Importa i tuoi contatti di Facebook. <a href='http://www.windowslive.it/importaAmici.aspx' target='_new'>Chiacchiera su Messenger!</a></body>
</html>