Hi Brian,<br><br>Thanks. <br><br>Last question: If I always use only the "global support" version, that should work for any transform, correct?<br>Except of course it will be slow when using local support transforms with many parameters ...<br>
<br>Do let me know. Thanks for the help.<br><br>Roshni<br><br><br><div class="gmail_quote">On Sat, Aug 18, 2012 at 6:13 PM, brian avants <span dir="ltr"><<a href="mailto:stnava@gmail.com" target="_blank">stnava@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi roshni<br>
<br>
short answer --- i hope to flesh out these details some time in the<br>
next few months.<br>
<br>
in the mean time, you may be right but i don't really follow your<br>
reasoning. surely, this is my lack of looking at the code.<br>
<br>
did you read the mattes paper? some relevant assumptions are explained there.<br>
<br>
now that you are familiar with the code, you may try out your<br>
suggestions and let us know how it goes.<br>
<br>
thanks again for looking into this ---<br>
<br>
brian<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
On Sat, Aug 18, 2012 at 5:33 PM, Roshni <<a href="mailto:roshni.b@gmail.com">roshni.b@gmail.com</a>> wrote:<br>
> Hi Brian,<br>
><br>
> Thanks for your response, but I still have some questions:<br>
><br>
> Consider a local support transform with parameters \theta = [\theta1,<br>
> \theta2 ... \thetaP].<br>
><br>
> Then the derivative of each voxel location w.r.t. \|theta will be non zero<br>
> only for a few parameters (due to the local support assumption). However, I<br>
> do not understand how we can get away with "m_LocalDerivativeByParzenBin"<br>
> being of size 4xP. (In<br>
> MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader::BeforeThreadedExecution()<br>
> lines 114-130.)<br>
><br>
> Is the assumption here that each parameter \theta_p affects only 4 bins in<br>
> the joint & moving-image-marginal PDFs?<br>
> If so, I'm not sure that the assumption holds:<br>
><br>
> For an arbitrary local support transform, each parameter \theta_p will<br>
> affect all voxels within its region of interest (ROI). So, for instance, if<br>
> the ROI for \theta_p has 2 voxels v_i and v_j, such that v_i contributes to<br>
> bins [k1 k2 k3 k4] and v_j contributes to [k3 k4 k5 k6] in the<br>
> moving-image-marginal PDF, then the derivatives of the joint and marginal<br>
> PDFs w.r.t \theta_p will be non-zero at at-least all six bins [k1 k2 k3 ..<br>
> k6].<br>
><br>
> Along the same lines, I do not follow how all the results are combined in<br>
> the<br>
> MattesMutualInformationImageToImageMetricv4::ComputeResults() function:<br>
><br>
> // Apply the pRatio and sum the per-window derivative<br>
> // contributions, in the local-support case.<br>
> if( this->m_ComputeDerivative )<br>
> {<br>
> if( this->HasLocalSupport() )<br>
> {<br>
> for( SizeValueType i = 0; i < this->m_DerivativeResult->Size(); i++ )<br>
> {<br>
> for( SizeValueType bin = 0; bin < 4; bin++ )<br>
> {<br>
> // Increment the m_JointPdfIndex1DArray index by bin in order to<br>
> recover<br>
> // the pRatio at the moving indecies used for each portion of the<br>
> derivative.<br>
> // Note: in old v3 metric ComputeDerivatives,<br>
> derivativeContribution is subtracted in global case,<br>
> // but added in "local" (implicit) case. These operations have<br>
> been switched to minimize the metric.<br>
> SizeValueType pRatioIndex = this->m_JointPdfIndex1DArray[i] + bin;<br>
> (*(this->m_DerivativeResult))[i] -=<br>
> m_LocalDerivativeByParzenBin[bin][i] * this->m_PRatioArray[pRatioIndex];<br>
> }<br>
> }<br>
> }<br>
> }<br>
><br>
> Here again the assumption seems to be that for the "i"th parameter \theta_i,<br>
> only 4 bins are affected and hence only the bin-specific weighting of those<br>
> bins is multiplied before adding the results.<br>
><br>
> IMHO, m_PRatioArray[][] should be pre-computed and then the derivative<br>
> contributions should be multiplied with the appropriate values before being<br>
> added.<br>
><br>
> That is, in<br>
> MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader::ComputePDFDerivatives()<br>
> (lines 373-377)<br>
><br>
> on line 375:<br>
> *( localSupportDerivativeResultPtr ) +=<br>
> derivativeContribution*m_PRatioArray[fixedImageParzenWindowIndex][pdfMovingIndex]<br>
> ;<br>
> in place of *( localSupportDerivativeResultPtr ) += derivativeContribution;<br>
><br>
> Does this make sense or am I missing something completely?<br>
> Please let me know what you think.<br>
><br>
> Thanks,<br>
> Roshni<br>
><br>
><br>
><br>
> On Sat, Aug 18, 2012 at 12:46 PM, brian avants <<a href="mailto:stnava@gmail.com">stnava@gmail.com</a>> wrote:<br>
>><br>
>> hi R<br>
>><br>
>> yes, a local support transformation only needs a few of the parameters<br>
>> to define a transformation of a given point. for instance, the<br>
>> transformation of a point by a discrete displacement field is<br>
>> determined by a small local neighborhood of information. for<br>
>> transformations of this type, the derivative of a specific parameter<br>
>> only depends upon the support or the local neighborhood that affects<br>
>> it. one of the main changes in v4 is that you can use the same<br>
>> metros for both local and global support transformations. the Mattes<br>
>> MI metric originated from this paper:<br>
>><br>
>> "PET-CT Image Registration in the Chest Using Free-form Deformations"<br>
>> D. Mattes, D. R. Haynor, H. Vesselle, T. Lewellen and W. Eubank IEEE<br>
>> Transactions in Medical Imaging. Vol.22, No.1, January 2003.<br>
>> pp.120-128<br>
>><br>
>> but much has changed in the implementation since then and there is<br>
>> currently no technical paper that accurately describes what's being<br>
>> done, in particular for the local support case. however, the basic<br>
>> idea is as described above: just compute the local derivative if your<br>
>> transform has local support.<br>
>><br>
>> hope this helps,<br>
>><br>
>> brian<br>
>><br>
>><br>
>><br>
>><br>
>> On Fri, Aug 17, 2012 at 8:51 PM, Roshni <<a href="mailto:roshni.b@gmail.com">roshni.b@gmail.com</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > I am trying to modify "itkMattesMutualInformationMetricv4" but am having<br>
>> > trouble following the logic behind the derivative computations when a<br>
>> > "local<br>
>> > support" transformation is used.<br>
>> > Please could someone explain the basic ideas used?<br>
>> ><br>
>> > Also, do local support transforms imply dense transformations with local<br>
>> > support basis functions, e.g. BSpline deformations?<br>
>> > Please help!<br>
>> ><br>
>> > Thanks much,<br>
>> > R<br>
>> ><br>
>> ><br>
>> > _____________________________________<br>
>> > Powered by <a href="http://www.kitware.com" 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" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Kitware offers ITK Training Courses, for more information visit:<br>
>> > <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" 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" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>