<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"
xmlns:ns0="urn:schemas-microsoft-com:office:smarttags">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.section1, li.section1, div.section1
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
ins
        {mso-style-type:export-only;
        text-decoration:none;}
span.msoIns
        {mso-style-type:export-only;
        text-decoration:underline;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hello, everyone<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to use itkResampleImageFilter to make some
transformation of the image. But it seems that all the intensity value of the
output is zero. Does anybody know what’s going on?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks! <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font> itk::Image<<font color=blue><span
style='color:blue'>unsigned</span></font> <font color=blue><span
style='color:blue'>short</span></font>, 3> ImageType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font> itk::ImageFileReader<ImageType>
ReaderType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> ReaderType::Pointer
reader = ReaderType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
reader->SetFileName( argv[1]);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font> itk::ResampleImageFilter<ImageType,
ImageType> ResampleType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> ResampleType::Pointer
resampler = ResampleType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> reader->Update();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> ImageType::Pointer
inputImage = reader->GetOutput();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> ImageType::SizeType
size = inputImage->GetLargestPossibleRegion().GetSize();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetSize(size);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font> itk::AffineTransform<<font
color=blue><span style='color:blue'>double</span></font>, 3> TransformType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
TransformType::Pointer transform = TransformType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetTransform(transform);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font>
itk::LinearInterpolateImageFunction<ImageType> InterpolationType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> InterpolationType::Pointer
interpolator = InterpolationType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetInterpolator(interpolator);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetOutputSpacing(spacing);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>double</span></font> origin[2];<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> origin[0] = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> origin[1] = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>origin[2] = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetOutputOrigin(origin);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
TransformType::OutputVectorType translation;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> translation[0] = 10;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> translation[1] = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>translation[2] = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
transform->Translate(translation);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetDefaultPixelValue(0);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->SetInput(reader->GetOutput());<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
resampler->Update();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> <font color=blue><span
style='color:blue'>typedef</span></font> itk::ImageFileWriter<ImageType>
WriterType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> WriterType::Pointer
writer = WriterType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> writer->SetInput(resampler->GetOutput());<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>
writer->SetFileName( argv[2]<font color=maroon><span style='color:maroon'> </span></font>);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'> writer->Update();</span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face="Times New Roman"><span style='font-size:10.0pt'>_____________________________________________</span></font> <o:p></o:p></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>Huanxiang Lu</span></font><o:p></o:p></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>Ph.D. Student,
Medical Image Analysis</span></font><o:p></o:p></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face="Times New Roman"><span style='font-size:10.0pt'><ns0:place
w:insAuthor="Miguel A. Gonzalez Ballester" w:insDate="2009-01-27T15:54:00Z"
w:endInsAuthor="Miguel A. Gonzalez Ballester" w:endInsDate="2009-01-27T15:54:00Z"><ns0:PlaceType
w:insAuthor="Miguel A. Gonzalez Ballester" w:insDate="2009-01-27T15:54:00Z"
w:endInsAuthor="Miguel A. Gonzalez Ballester"
w:endInsDate="2009-01-27T15:54:00Z"><font face=Arial><span style='font-family:
Arial'>University</span></font><u style='text-decoration:none'><span
class=msoIns><ins cite="mailto:Miguel%20A.%20Gonzalez%20Ballester"
datetime="2009-01-27T15:54"></ns0:PlaceType></ins></span></u><font
face=Arial><span style='font-family:Arial'> of </span></font><ns0:PlaceName
w:insAuthor="Miguel A. Gonzalez Ballester" w:insDate="2009-01-27T15:54:00Z"
w:endInsAuthor="Miguel A. Gonzalez Ballester"
w:endInsDate="2009-01-27T15:54:00Z"><font face=Arial><span style='font-family:
Arial'>Bern</span></font><u style='text-decoration:none'><span class=msoIns><ins
cite="mailto:Miguel%20A.%20Gonzalez%20Ballester" datetime="2009-01-27T15:54"></ns0:PlaceName></ins></span></u></ns0:place></span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>ARTORG Center for
Biomedical Engineering Research <o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span lang=DE style='font-size:10.0pt;font-family:Arial'>Stauffacherstrasse
78<o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span lang=DE style='font-size:10.0pt;font-family:Arial'>CH-3014
Bern<o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span lang=DE style='font-size:10.0pt;font-family:Arial'>Tel +41 31
631 59 49</span></font><o:p></o:p></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span lang=DE style='font-size:10.0pt;font-family:Arial'>Fax +41 31
631 59 60<o:p></o:p></span></font></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=2
face=Arial><span lang=DE style='font-size:10.0pt;font-family:Arial'><a
href="mailto:huanxiang.lu@artorg.unibe.ch"
title="mailto:huanxiang.lu@artorg.unibe.ch mailto:serena.bonaretti@artorg.unibe.ch">huanxiang.lu@artorg.unibe.ch</a></span></font><o:p></o:p></p>
<p class=section1 style='margin:0cm;margin-bottom:.0001pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><a
href="http://www.artorg.unibe.ch/" title="http://www.artorg.unibe.ch/"><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>www.artorg.unibe.ch/</span></font></a><font
color=navy><span style='color:navy'><o:p></o:p></span></font></span></font></p>
</div>
</body>
</html>