<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hi insight-users,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have a problem with writing Dicom files
after reading</FONT></DIV>
<DIV><FONT face=Arial size=2>a serie to an image and</FONT><FONT face=Arial
size=2> performing a resampling on the Image.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>After the image is resampled, by decreasing
resolution</FONT></DIV>
<DIV><FONT face=Arial size=2>of a factor of 1/2 for example, I write the
serie out.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>However, when I read the written serie and render
it with</FONT></DIV>
<DIV><FONT face=Arial size=2>GLSliceView class e.g., it shows two small images
side by side</FONT></DIV>
<DIV><FONT face=Arial size=2>and the rest of the image is grey.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I may have missed to set some parameters for the
output,</FONT></DIV>
<DIV><FONT face=Arial size=2>but I can't determine which.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can somebody please give me an advice, how to solve
this problem.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Markus</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<DIV>PS:</DIV>
<DIV>Writing code is as follows:</DIV>
<DIV> </DIV>
<DIV> //Write DICOM Series<BR> if(imageExtension
=="dcm")<BR> {<BR> <BR> typedef
itk::Image<PixelType,2> Image2DType;<BR> typedef
itk::ImageSeriesWriter< ImageType, Image2DType >
SeriesWriterType;<BR> typedef itk::NumericSeriesFileNames
NameGeneratorType;</DIV>
<DIV> </DIV>
<DIV> std::string format = filename + std::string("%03d") +
std::string(".dcm");<BR> <BR> SeriesWriterType::Pointer swriter =
SeriesWriterType::New();<BR> movingImage->Update();<BR> swriter->SetInput(
movingImage );<BR> swriter->SetImageIO( m_gdcmIO );
//DICOM imageIO used for reading</DIV>
<DIV> </DIV>
<DIV> NameGeneratorType::Pointer nameGenerator =
NameGeneratorType::New();<BR> ImageType::RegionType region =
movingImage->GetLargestPossibleRegion();<BR> ImageType::IndexType start
= region.GetIndex();<BR> ImageType::SizeType size =
region.GetSize();<BR> const unsigned int firstSlice =
start[2];<BR> const unsigned int lastSlice = start[2] + size[2] -
1;<BR> nameGenerator->SetStartIndex(firstSlice);<BR> nameGenerator->SetEndIndex(lastSlice);<BR> nameGenerator->SetIncrementIndex(1);</DIV>
<DIV> </DIV>
<DIV>
nameGenerator->SetSeriesFormat(format.c_str());<BR>
swriter->SetFileNames( nameGenerator->GetFileNames()
);<BR> </DIV>
<DIV> m_seriesFileNames->SetOutputDirectory(directory.c_str());<BR> swriter->SetMetaDataDictionaryArray(
m_fileSeriesReader->GetMetaDataDictionaryArray() );
//FileSeriesReader which was used for reading<BR> <BR> // Try to
write the serie:<BR> try<BR> {<BR>
swriter->Update();<BR> }<BR> catch(
itk::ExceptionObject & excp )<BR> {<BR>
std::cerr << "Exception thrown while writing the series " <<
std::endl;<BR> std::cerr << excp <<
std::endl;<BR>
}<BR> <BR> }</DIV></FONT></DIV></BODY></HTML>