I think that only changes the spacing of the image artificially and does not change the image size and its contents.<br><br>It is best to use a ResampleImageFilter and you can set the output spacing and size of the output image:<br>
<br> ResampleFilterType::Pointer resample = ResampleFilterType::New();<br> resample->SetTransform ( transform ); // identity transform<br> resample->SetInterpolator ( interp ); // linear interpolator<br> resample->SetInput ( reader->GetOutput() );<br>
resample->SetSize ( size );<br> resample->SetOutputOrigin ( origin );<br> resample->SetOutputSpacing ( spacing );<br> resample->SetDefaultPixelValue ( 0 );<br> resample->Update();<br><br>Kishore<br><br>
<div class="gmail_quote">On Tue, Mar 30, 2010 at 5:40 PM, michiel mentink <span dir="ltr"><<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I think the easiest option for you would be just to open an image, and then<br>
decrease the pixel size.<br>
After opening an image, the pixel size is just a property of the matrix with<br>
pixel values.<br>
<br>
You can get that property with<br>
<br>
<br>
image=reader->GetOutput(); // open your image<br>
<br>
ImageType::SpacingType sp = image->GetSpacing();<br>
std::cout << "Spacing = ";<br>
std::cout << sp[0] << ", " << sp[1] << ", " << sp[2] << std::endl;<br>
<br>
Then, divide all spacing parameters by 1.07:<br>
<br>
sp[0] = sp[0]/1.07;<br>
sp[1] = sp[1]/1.07; // etc.<br>
<br>
and then set the spacing:<br>
<br>
image->SetSpacing(sp)<br>
<br>
After that, you will have changed the dimension of your image without having<br>
touched any of your pixels. Ideal.<br>
<br>
cheers, Michael<br>
<div><div></div><div class="h5"><br>
<br>
<br>
On 3/30/10, Reda, Fitsum A <<a href="mailto:fitecx@gmail.com">fitecx@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> I wanted to downsample CT volumes using floating point scale , say,<br>
> (scale_x, scale_y,scale_z) = (1.07, 1.07, 1.07);<br>
> I would really appreciate any help with this. I am kind of getting started<br>
> with itk.<br>
><br>
> Thanks in advance,<br>
> Reda<br>
><br>
><br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>