<div dir="ltr">Dear Matias,<div><br></div><div>thank you very much for your quick reply. </div><div><br></div><div>Unfortunately, I didn't have time yet to test it. Anyhow, could you please tell me the rationale behind it?</div><div><br></div><div>In my code:</div><div><br></div><div><ol><li>I read two grayscale 16 bit .mhd images. To read them I define the IOPixelTyep as unsigned short;</li><li>I cast them to the "operational" type called PixelType as float </li><li>I define all the registration objects templated on float.</li></ol><div>Why should I cast my images to PixelType == signed short? </div><div><br></div><div>Thanks in advance for the support,</div><div>Luigi </div></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-10 15:45 GMT+01:00 Matias Montroull <span dir="ltr"><<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">try this:<div>typedef signed short PixelType;</div><div><br></div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">El mar., 10 de nov. de 2015 a la(s) 11:36 a. m., Luigi Riba <<a href="mailto:ribaluigi@gmail.com" target="_blank">ribaluigi@gmail.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Matt,<div><br></div><div>I have tried following your suggestion but, unfortunately, it didn't work out.</div><div><br></div><div>In particular:</div><div><ol><li>I read a pair of uint16 images;</li><li>I cast them to float pixel type via the CastImageFilter;</li><li>I change the TInternalComputationValueType for the metric, the optimizer, the transform and the registration doing something like:</li></ol></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">const unsigned int Dimension = 3; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef float PixelType;</blockquote></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>typedef unsigned short IOPixelType;</div></blockquote></div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::Image<IOPixelType, Dimension> IOImageType; </blockquote></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::Image<PixelType, Dimension> ImageType;</blockquote></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::AffineTransform<float, Dimension > TransformType;</blockquote></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::RegularStepGradientDescentOptimizerv4<float> OptimizerType;</blockquote></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::MeanSquaresImageToImageMetricv4<ImageType, ImageType,ImageType,float> MetricType;</blockquote></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::ImageRegistrationMethodv4<ImageType, ImageType, TransformType> RegistrationType;</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">typedef itk::ResampleImageFilter<IOImageType, IOImageType, float,float> ResampleFilterType;</blockquote><div> </div></div></blockquote><div><br></div><div><div><br></div><div>I have put one memory probe before the registration procedure and one afterwards of it. In the "double" case and in the "float" case I've seen the same memory consumption.</div><div><br></div><div>Am I missing something? Are there other things I should change in my code?</div></div><div><br></div><div>Thanks again for the support,</div><div>Luigi</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">2015-11-09 17:23 GMT+01:00 Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span>:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Luigi,<br>
<br>
The type of optimizer should not have too large of an impact on memory<br>
consumption. Using a gradient-free optimizer may help slightly, but<br>
try changing the pixel type of the input images or, if possible, the<br>
parameter type of the transformation, from double to float.<br>
<br>
HTH,<br>
Matt<br>
<div><div><br>
On Mon, Nov 9, 2015 at 10:24 AM, Luigi Riba <<a href="mailto:ribaluigi@gmail.com" target="_blank">ribaluigi@gmail.com</a>> wrote:<br>
> Dear all,<br>
><br>
> I am registering a couple of volumes with ITK 4 on windows 7 64 bit.<br>
><br>
> I wrote a code based on the affine transformation, with the mean square<br>
> error metric and the RegularStepGradientDescentOptimizerv4. Unfortunately,<br>
> the memory usage is pretty high.<br>
><br>
> I have checked memory consumption with the itkMemoryProbe and, after looking<br>
> around on previous mailing list messages I have decided to try with a<br>
> gradient free optimizer like the Nelder-Mead one.<br>
><br>
> So I have rewrote the code using the AmoebaOptimizerV4 and I have continued<br>
> monitoring the memory consumption via MemoryProbe. Unfortunately, it seems<br>
> that nothing has changed. Is this working as expected? If this is the case,<br>
> do you have any suggestion to gave me in order to reduce the memory<br>
> consumption of the code?<br>
><br>
> Thanks in advance for the help.<br>
><br>
> Best,<br>
><br>
> Luigi<br>
><br>
</div></div>> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
> <a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
><br>
</blockquote></div></div>
_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div dir="ltr">Matias</div>
</font></span></blockquote></div><br></div>