<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div>Hello Chad,</div>
</div>
</div>
<div><br>
</div>
<div>One other thing you can try is to use an even simpler similarity metric. For unimodal registration you can try the mean squares metric. It is simpler than correlation, but the assumption on the data becomes stricter (intensities haven’t changed vs. a linear
 change which is what the correlation is accommodating). </div>
<div><br>
</div>
<div>Possibly this will provide some speedup.</div>
<div>             Ziv</div>
<div><br>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Chadwick Rothenberg <<a href="mailto:chadrothenberg@gmail.com">chadrothenberg@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, August 26, 2015 at 11:16 AM<br>
<span style="font-weight:bold">To: </span>"Lowekamp, Bradley (NIH/NLM/LHC) [C]" <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:community@itk.org">community@itk.org</a>" <<a href="mailto:community@itk.org">community@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [ITK] b-spline registration performance<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">Hello,
<div><br>
</div>
<div>Thank you for the helpful replies.</div>
<div><br>
</div>
<div>For the metric, I am using correlation since it's unimodal registration, and I have 32 threads (16 physical cores total with 2 CPUs, 8 cores on each).</div>
<div><br>
</div>
<div>Also, I've heard that the interpolator can affect the registration performance, and I'm currently trying out different ones (using linear for default).</div>
<div><br>
</div>
<div>For the registration initiation, the Python (SimpleITK) process's CPU % goes up all the way for couple minutes, and then it drops—I only see 1~3% activity (virtually no activity) and no change in memory. And this period seems to be correlated with the
 image size and also the mesh size for b-spline transformation—if I use a large number of nodes for the mesh, it can even take up to couple hours.</div>
<div><br>
</div>
<div>Is this a known issue? or Am I doing something wrong?<br>
</div>
<div><br>
</div>
<div>Thanks!</div>
<div><br>
</div>
<div>
<div>Regards,</div>
<div>Chad</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Aug 26, 2015 at 9:52 AM, Bradley Lowekamp <span dir="ltr">
<<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>
<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">
Hello,<br>
<br>
The obvious thing to do is try to compute less. Use less pixels, and less samples ( as Matt already suggested ).<br>
<br>
What the size of you image (3000x2500x100) and an initial BSpline mesh size of (25x25x10) you may want to run the BinShrink filter with 10x10x2 to reduce the resolution of the image for the first pass with the low resolution mesh. Still use multi-scale and
 only a percentage of the pixels for the metric. Also note how long it take the registration to start, before the iterations start.<br>
<br>
Then you can run another registration with a higher resolution mesh and image. You likely still don't need to full resolution image.<br>
<br>
What metric are you using? It may be worth profiling the effect of the number of threads for the metric you are using.<br>
<br>
HTH,<br>
Brad<br>
<div>
<div class="h5"><br>
<br>
On Aug 25, 2015, at 10:51 PM, Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>> wrote:<br>
<br>
> Hi Chad,<br>
><br>
>> I'm new to non-rigid image registration and ITK, and I've been using<br>
>> SimpleITK to perform b-spline registrations.<br>
><br>
> Welcome to ITK!<br>
><br>
><br>
>> I am working with relatively large images (pixels, x: 3000, y: 2500, z: 100)<br>
>> with dense information (microscopy images), and I'm quite frustrated with<br>
>> the speed / computation time.<br>
>><br>
>> I'm following<br>
>> (<a href="https://github.com/SimpleITK/SimpleITK/blob/master/Examples/ImageRegistrationMethodBSpline2.py" rel="noreferrer" target="_blank">https://github.com/SimpleITK/SimpleITK/blob/master/Examples/ImageRegistrationMethodBSpline2.py</a>)<br>
>> except that I'm using (25, 25, 10) mesh (ideally higher numbers if<br>
>> feasible), correlation for metrics (I'm working with unimodal), and using<br>
>> down-sampled images with multi-resolution registration (12x smaller, 6x<br>
>> smaller). With two E5 2687w processors, the Python process (the SimpleITK)<br>
>> takes about 70~80% CPU. Ideally I'd like to use at least (40, 40, 20) mesh.<br>
>><br>
>> 1. Will I gain any performance by using ITK instead of SimpleITK?<br>
><br>
> If you are using the same approach, there will effectively be no<br>
> performance difference.<br>
><br>
><br>
>> 2. What advice could you give me to improve the b-spline registration speed<br>
>> (both in general and specifically in SimpleITK)?<br>
><br>
> Get the registration working well with the large image when densely<br>
> sampling the images for metric computation.  Then, progressively<br>
> decimate the metric sampling [1] until registration performance<br>
> declines.  Increase the sampling percentage again with an additional<br>
> safety factor.<br>
><br>
> Hope this helps,<br>
> Matt<br>
><br>
><br>
> [1] <a href="http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ImageRegistrationMethod.html#adca6e03c04216fca8ba0d90d84cb9600" rel="noreferrer" target="_blank">
http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ImageRegistrationMethod.html#adca6e03c04216fca8ba0d90d84cb9600</a><br>
</div>
</div>
> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org">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>
<br>
</div>
</div>
</div>
</div>
</span>
</body>
</html>