Hi Marius, <br><br>You were right. It was about the division of zero. I have run elastix using the version of the svn and I works without -nan. Now just waiting to see if the registration approach improve my older results. <div>
<br></div><div>Thanks a lot!</div><div><br></div><div>Albert<br><br><div class="gmail_quote">2011/7/27  <span dir="ltr">&lt;<a href="mailto:M.Staring@lumc.nl">M.Staring@lumc.nl</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">






<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hi Albert,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I just committed a bugfix to the svn repository that solves a couple of division by zero problems.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">You can try it by checking out the latest svn:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">               
<a href="https://svn.bigr.nl/elastix/trunkpublic/" target="_blank">https://svn.bigr.nl/elastix/trunkpublic/</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">using elastixguest as the username and password.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Marius<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> Staring, M. (LKEB)
<br>
<b>Sent:</b> dinsdag 26 juli 2011 13:59<br>
<b>To:</b> &#39;Albert Gubern Mérida&#39;</span></p><div class="im"><br>
<b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
</div><b>Subject:</b> RE: [Insight-users] B-Splines registration with fixed points<u></u><u></u><p></p>
</div>
</div><div class="im">
<p class="MsoNormal" style="margin-left:36.0pt"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">Hi Albert,<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">It looks like we are not checking for division by zero or something like that, so probably a bug.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">(The modified pointset does not have a distance of zero at the start already, and I think your fixed and moving image have identical
 spacing etc)<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">Can you also give me your fixed and moving image, so I can reproduce this?<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
</div><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D">Marius<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:krekbert@gmail.com" target="_blank">krekbert@gmail.com</a> [mailto:<a href="mailto:krekbert@gmail.com" target="_blank">krekbert@gmail.com</a>]
<b>On Behalf Of </b>Albert Gubern Mérida</span></p><div class="im"><br>
<b>Sent:</b> dinsdag 26 juli 2011 11:38<br>
</div><div><div></div><div class="h5"><b>To:</b> Staring, M. (LKEB)<br>
<b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
<b>Subject:</b> Re: [Insight-users] B-Splines registration with fixed points<u></u><u></u></div></div><p></p><div><div></div><div class="h5">
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">Hi Marius, <br>
<br>
I was using version 4.3. I have just upgraded to 4.4 i have already tried what you told me. Here an overview what I do:<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">1. I obtain the sternum points from the fixed and moving image.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">2. I apply a translation in y direction to the moving image. Then both pectoral/sternums are aligned. I do that &quot;manually&quot; not using elastix. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt">
3. I apply the registration code using similar elastix parameter file as the one you sent to me to penalize deviation away from the sternum points. Because the moving input images is already translated, the sternum points is the same as the one in the fixed
 image. So, the text file which contains the list of points are the same for the fixed and moving images. However, doing that I get the following output ( I attach the log file called elastix_same_points.log. Note in it that moving_points.txt and fixed_points.txt
 contains exactly the same points):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">##########################################################################################################################################<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">  Sampling gradients ...<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">  Progress: 100%  Sampling the gradients took 1 Minutes, 24 Seconds<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">Automatic parameter estimation took 1 Minutes, 25 Seconds<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">1:ItNr<span> 
</span>2:Metric<span>           </span>3a:Time<span>          
</span>3b:StepSize<span>     </span>4:||Gradient||<span>   
</span>Metric0<span>            </span>Metric1<span>           
</span>Time[ms]<span>            </span>||Gradient0||<span>    
</span>||Gradient1||<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">0<span>         
</span>-0.938266<span>        </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>-0.938266<span>        </span>0.000000<span>        
</span>92520<span>  </span>0.001563<span>           
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">1<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">2<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">3<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">4<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">5<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">6<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>720<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">7<span>         
</span>-nan<span>     </span>0.000000<span>        
</span>1097.045756<span>   </span>-nan<span>    
</span>0.000000<span>         </span>-nan<span>    
</span>710<span>      </span>0.000000<span>        
</span>-nan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-left:72.0pt">########################################################################################################################################################<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">I have tried the same but slightly modifying the moving points list ( decreasing 1 unit of y_direction ). Then I don&#39;t get the -nan output and the registration finishes (I haven&#39;t done enough tests to decide if
 it does what I need). I also attach the log file called elastix_modified_points.log<br>
<br>
Btw, any idea why I get the -nan output? Shall I, instead of doing the &quot;manual&quot; registration, initialize the b-splines registration with the y translation? <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt">
Albert<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">2011/7/25 &lt;<a href="mailto:M.Staring@lumc.nl" target="_blank">M.Staring@lumc.nl</a>&gt;<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D">Hi Albert,</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D">It is available from elastix version 4.4, so if you are running that version you are good.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D">Parameters should be similar to the attached file.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D">Regards,</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D">Marius</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:krekbert@gmail.com" target="_blank">krekbert@gmail.com</a> [mailto:<a href="mailto:krekbert@gmail.com" target="_blank">krekbert@gmail.com</a>]
<b>On Behalf Of </b>Albert Gubern Mérida<br>
<b>Sent:</b> maandag 25 juli 2011 16:21<br>
<b>To:</b> Staring, M. (LKEB)<br>
<b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
<b>Subject:</b> Re: [Insight-users] B-Splines registration with fixed points</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:108.0pt">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
Hi Marius,<br>
<br>
Thanks a lot. It seems to be what I exactly need. Anyway, is this registration available to run using the binary elastix (what I have been using at the moment)? If not, which components or/and testing files should I use to implement it? <u></u><u></u></p>

<div>
<p class="MsoNormal" style="margin-left:108.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:108.0pt">
Thanks again, and sorry for my ignorance.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:108.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:108.0pt">
Albert<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:108.0pt">
2011/7/25 &lt;<a href="mailto:M.Staring@lumc.nl" target="_blank">M.Staring@lumc.nl</a>&gt;<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D">Hi Albert,</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D">If you have the coordinates of the sternum in both fixed and moving image you can add a term to the registration framework that penalizes deviation away from alignment of that point (or multiple points). We have
 done something similar:</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"><a href="http://elastix.isi.uu.nl/marius/publications/2011_c_MICCAIb.html" target="_blank">http://elastix.isi.uu.nl/marius/publications/2011_c_MICCAIb.html</a></span><u></u><u></u></p>

<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D">code of which can be found in elastix, which you can use freely.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D">But it all depends on whether you have corresponding pointsets.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D">Marius</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:108.0pt">
<span style="font-size:11.0pt;color:#1F497D"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:144.0pt">
<b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:insight-users-bounces@itk.org" target="_blank">insight-users-bounces@itk.org</a> [mailto:<a href="mailto:insight-users-bounces@itk.org" target="_blank">insight-users-bounces@itk.org</a>]
<b>On Behalf Of </b>Albert Gubern Mérida<br>
<b>Sent:</b> maandag 25 juli 2011 15:41<br>
<b>To:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
<b>Subject:</b> [Insight-users] B-Splines registration with fixed points</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:144.0pt">
Hi all,<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
I am currently working in Breast MRI registration between different patients, especially interested in the alignment of body area (thorax + pectoral muscles). The first step of my registration consist of a translation to align the sternum, which gives a good
 initial alignment of the pectoral muscles. In the following link you can see an example of one slice with the sternum indicated with a white cross: <a href="http://imageshack.us/photo/my-images/220/breastmristernum.png/" target="_blank">http://imageshack.us/photo/my-images/220/breastmristernum.png/</a>. After
 the translation step with the pectorals already &quot;rigidly&quot; aligned I apply non-rigid b-splines registration to the whole volumes. It works well in some cases, but in others, especially of course when the differences are high between fixed and moving images,
 the non-rigid registration move the sternum point and the pectorals are not aligned anymore. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
I have thought that not allowing the non-registration the move of the sternum point and the ones close to it could be a good solution for such problem. However, I have taken a look to the classes and the mailing list but I have not found any direct/easy example
 to how to do that. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
Could anyone give me some advice? Does a easy way to do it exist or I should modify the classes involved in the registration framework? Which ones should I take a look? <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
Thanks in advance,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:144.0pt">
Albert<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:108.0pt">
 <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:72.0pt"><u></u> <u></u></p>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>