Hi habibbaluwala,<br><br>I don't think that the API of the image was <br>designed to allow for in-place resizing of <br>the image.<br><br>The Update() call certainly will not do the <br>trick.<br><br>You may want to try calling Allocate(),<br>
just after you change the image regions<br>inside that function...<br><br>but again, <br><br>I will be surprised if that works...<br><br>---<br><br>Let's go back to basics:<br><br>1) Were you expecting (or hoping) that<br>
the pixel content of the image will <br> remain untouched as you resize it ?<br><br>2) If so, what you need to use is the<br> ResampleImageFilter...<br><br>3) Or the RegionOfInterestImageFilter<br> (if the new region is smaller than<br>
the original one).<br><br><br>You may find useful to look at the<br>ITK Software Guide:<br><br> <a href="http://www.itk.org/ItkSoftwareGuide.pdf">http://www.itk.org/ItkSoftwareGuide.pdf</a><br><br>In particular, to<br>
<br>Section 6.9.4 "Resample Image Filter"<br>in pdf-page 254, up to page 284.<br><br><br><br><br> Regards,<br><br><br> Luis<br><br><br>----------------------------------------------------------------------<br>
<div class="gmail_quote">On Tue, Sep 28, 2010 at 1:00 PM, habibbaluwala2010 <span dir="ltr"><<a href="mailto:habibbaluwala@gmail.com">habibbaluwala@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hello Everyone ,<br>
I have been suffering with a minor problem where any<br>
changes that I make in the image in a supplementary function is not<br>
reflected in the main function. I.e. if I change the size of the image in<br>
the function that change is not reflected in the Main function . The example<br>
below will provide a brief review:<br>
<br>
<br>
<br>
template<typename RType><br>
void image_resize_filter (RType *test_image)<br>
{<br>
RType:: IndexType start; start[0]=0;start[1]=0;start[2]=0;<br>
RType::RType imageSize;<br>
imageSize[0]=200;<br>
imageSize[1]=200;<br>
imageSize[2]=200;<br>
RType::RegionType region;<br>
region.SetSize(imageSize); region.SetIndex(start);<br>
test_image->SetRegions(region);<br>
test_image->Update();<br>
<br>
}<br>
<br>
<br>
void main ()<br>
{<br>
typedef float PixelType;<br>
const unsigned int Dimension = 3;<br>
typedef itk::Image< PixelType, Dimension > ImageType;<br>
ImageType:: IndexType start; start[0]=0;start[1]=0;start[2]=0;<br>
<br>
ImageType::SizeType imageSize;<br>
imageSize[0]=100;<br>
imageSize[1]=100;<br>
imageSize[2]=100;<br>
ImageType::Pointer test1=ImageType::New();<br>
ImageType::RegionType region;<br>
region.SetSize(imageSize); region.SetIndex(start);<br>
test1->SetRegions(region); test1->Allocate();<br>
test1->FillBuffer(100.0); test1->SetSpacing(space);<br>
<br>
// Change Image resolution in the function<br>
<br>
image_resize_filter<ImageType>(test1);<br>
}<br>
<br>
Now after running this program it does not increase the size of the image .<br>
It would be very helpful if someone could point out the mistake in that....<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://old.nabble.com/Passing-itk-images-to-functions-tp29830622p29830622.html" target="_blank">http://old.nabble.com/Passing-itk-images-to-functions-tp29830622p29830622.html</a><br>
Sent from the ITK - Users mailing list archive at Nabble.com.<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>