The .5 is to round the size to the nearest integral value.<br><br><div class="gmail_quote">On Wed, Oct 7, 2009 at 7:41 AM, Juliette Deniau <span dir="ltr"><<a href="mailto:juliette.deniau@yahoo.fr">juliette.deniau@yahoo.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%;">Hi Bill, </span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%;">Thank you very much for your answer.</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">I tried your code and it is working for my data, thanks. However, what is wrong in my code is not the size (I compute it as you did) but it’s in the statement code: </font>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">resampler->SetOutputDirection ( reader->GetOutput()->GetDirection());</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">which I do not include in my code. Actually I do not set the direction of my resamopling filter(I have not find such thing elsewhere !).</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">I have another question regarding how you compute the output size. In your code you do the following:</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">outputSize[i] = <span style="color: blue;">static_cast</span><SizeValueType>(inputSize[i] * inputSpacing[i] / outputSpacing[i] + .5);</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">my question is why you add the 0.5 to the outputSpacing[i]? what I’m doing to compute the size is the follwing:</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">outputSize[i] = (inputSize[i] * inputSpacing[i] / outputSpacing[i]);</span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New';">Regards </span>
</p><p class="MsoNormal" style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">Juliette</font><br><br>--- En date de : <b>Mar 6.10.09, Bill Lorensen <i><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></i></b> a écrit :<br>
</p><blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;"><br>De: Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
Objet: Re: [Insight-users] Segmented volume scaling problem, why its working with 2D and not with 3D?<br>À: "Juliette Deniau" <<a href="mailto:juliette.deniau@yahoo.fr" target="_blank">juliette.deniau@yahoo.fr</a>><br>
Cc: "luis ibanez" <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>>, "insight" <<a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>><br>
Date: Mardi 6 Octobre 2009, 16h08<div><div></div><div class="h5"><br><br>
<div>I suspect that your size calculation is incorrect.<br><br>Attached is a program that will resample a meta volume. (Note it uses a LinearInterpolateImageFunction. You should change this to a nearest neighbor interpolator).<br>
<br>You can see how I calculate the size.<br><br>Bill<br><br>
<div class="gmail_quote">On Tue, Oct 6, 2009 at 10:09 AM, Juliette Deniau <span dir="ltr"><<a href="http://fr.mc282.mail.yahoo.com/mc/compose?to=juliette.deniau@yahoo.fr" rel="nofollow" target="_blank">juliette.deniau@yahoo.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font-family: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">Dear Luis and Itk users,</font> </p></td></tr></tbody></table></blockquote></div>
<p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">I’m trying to scale a segmented volume (obtained by confidence connected filter)using itkAffineTransform but the result volume has information only in one slide. When I use the original volume instead of the segmented one, the results are fine.</font> </p>
</div>
<p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">I applied the same code to <span> </span>2D image ( segmented <span> </span>image using confidence connected filter)and the original image, the results are fine for both of them.</font>
</p><p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">What I cannot understand is why<span> </span> this is working for 2D original image, 2D segmented image, the original volume and not for the 3D segmented volume ?</font>
</p><p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">I attach both codes that I use for my test(2D and 3D cases)</font>
</p><p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">Thank you </font>
</p><p style="margin: 0cm 0cm 10pt;"><font face="Calibri" size="3">Juliette</font></p></div></div></blockquote></td></tr></tbody></table><div><div></div><div class="h5"><font color="#888888"><br></font><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com/" rel="nofollow" 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" rel="nofollow" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="nofollow" 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" rel="nofollow" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br><br><br><br>
</div></div></blockquote></div><br>