Hi Luis,<br><br>I was only trying to test the application. I already thought that it wouldn&#39;t work, but I thought and I don&#39;t understand yet why if I create my own 3d images the registration doesn&#39;t work with 4 levels of multiresultion. Is the error &quot;Joint PDF summed to zero&quot; caused because in the 4th level the registration doesn&#39;t have enough pixels? <br>
<br>My 3d images are composed by the slices used in 2D test copied 4 times. In that way I have a 3d brain image in the center as a fixed (the same slice repeated 4times), and all the slices of the moving are the same brain with the same rotation and translation. So, each slice overlaps each other in both volumes, and because of this I think it should work.<br>
<br>Is it only caused because the size of the images is not big enough to work with 4 multiresolution levels or is another problem?  <br><br>My goal is the registration of two prostates MRI of differents patients in order to build an atlas. <br>
<br><br>Thanks!<br><br>Albert<br><br><br><div class="gmail_quote">2009/3/21 Luis Ibanez <span dir="ltr">&lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Albert,<br>
<br>
<br>
Nope,<br>
<br>
There is *no way* that a 3D Affine registration will<br>
work correctly if you feed it with 2D images.<br>
<br>
I&#39;m guessing that you are feeding 2D input images to<br>
a 3D image reader, and therefore you end up with 3D<br>
images that have a single slice.<br>
<br>
<br>
They are therefore very thin in 3D space, and at the<br>
first perturbation of the 3D terms (e.g a translation<br>
in Z, or a rotation around X, or Y) then then overalp<br>
of the images will be reduced to empty space of to<br>
simply a line in 3D space.<br>
<br>
<br>
You are trying to overlap two pieces of 2D paper in<br>
a 3D space,... most of the time, they won&#39;t even<br>
intersect at all.<br>
<br>
<br>
So the big question is:<br>
<br>
<br>
    Why would you want to register<br>
    two 2D images in 3D space ??!!<br>
<br>
<br>
Maybe you should give us more background on what your<br>
real image processing application is intended to do...  :-)<br>
<br>
<br>
<br>
    Thanks<br>
<br>
<br>
       Luis<br>
<br>
<br>
<br>
---------------------<div><div></div><div class="h5"><br>
Albert Gubern wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi again,<br>
<br>
Thanks Luis your answer, it is working correctly in 2D.<br>
<br>
Now I&#39;m extending the code to 3D images. I modified the Dimension to 3 and the optimizer scales (9 for rotation and 3 for translation).<br>
<br>
I test the code using the same images with the same command arguments that you told me before and a new error appears before doing the registration:<br>
<br>
##############################<br>
####################<br>
<br>
FixedImage schedule: [4, 4, 4]<br>
[2, 2, 2]<br>
[1, 1, 1]<br>
<br>
MovingImage schedule: [4, 4, 4]<br>
[2, 2, 2]<br>
[1, 1, 1]<br>
<br>
-------------------------------------<br>
MultiResolution Level : 0<br>
<br>
ExceptionObject caught !<br>
<br>
itk::ExceptionObject (0100FDF4)<br>
Location: &quot;void __thiscall itk::MattesMutualInformationImageToImageMetric&lt;class itk::Image&lt;float,3&gt;,class itk::Image&lt;floa<br>
t,3&gt; &gt;::GetValueAndDerivative(const class itk::Array&lt;double&gt; &amp;,double &amp;,class itk::Array&lt;double&gt; &amp;) const&quot;<br>
File: c:\bert\itk_vtk\src\itk\insighttoolkit-3.12.0\code\algorithms\itkMattesMutualInformationImageToImageMetric.txx<br>
Line: 1138<br>
Description: itk::ERROR: MattesMutualInformationImageToImageMetric(014A27B8): Joint PDF summed to zero<br>
<br>
#######################################<br>
<br>
I thought that the error is produced because I&#39;m working with 2d images, but the registration works if the number of levels of the multiresolution registration is 1. Can the 3d registration work with 2d images? I know that with Mean Squares metric it isn&#39;t possible but this problem shouldn&#39;t appear with Mattes Mutual information metric because it works with histograms...<br>

<br>
However, I test it with 3d images (the same 2d images of the brain repeated 4 times) and the error appear when the number of levels are 4 (works correctly with 1,2 and 3 levels). Also I&#39;ve worked with different percentage of samples (from 20% to 100%) and number of bins (32 and 128) and the error continues appearing.<br>

<br>
I read in <a href="http://www.itk.org/pipermail/insight-users/2009-February/028917.html" target="_blank">http://www.itk.org/pipermail/insight-users/2009-February/028917.html</a> that it could be caused by something missed, but I think I do all the necessary changes to do the 3D registration.<br>

<br>
What could the mistake be? Working with 2d images? Something missed?<br>
<br>
Thanks in advance,<br>
<br>
Albert<br>
<br>
PD: I can&#39;t attach the code without exceeding the size limit.<br>
<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Albert<br>