Hi Luis,<br><br>Yes, I could fix it. And write access could come in handy in similar situations later on. But I thought you abandoned CVS in favor of something else (svn maybe)?<br><br>Regards,<br>Dženan<br><br><div class="gmail_quote">
2010/5/26 Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Dženan,<br>
<br>
You seem to have identified a real bug.<br>
<br>
Could you please log a bug entry at:<br>
<a href="http://public.kitware.com/Bug/my_view_page.php" target="_blank">http://public.kitware.com/Bug/my_view_page.php</a><br>
<br>
As you already pointed out, it looks like the source of the<br>
error is the manual computation of conversions between<br>
indexes and point coordinates in lines 442-446:<br>
<br>
point = points.Value();<br>
<br>
newpoint[0] = (point[0]-m_Origin[0]) * invspacing[0];<br>
newpoint[1] = (point[1]-m_Origin[1]) * invspacing[1];<br>
newpoint[2] = (point[2]-m_Origin[2]) * invspacing[2];<br>
<br>
which should have been something like:<br>
<br>
image->TransformPhysicalPointToIndex( point, newpoint );<br>
<br>
or even better, we should rename the variable "newpoint"<br>
as "newindex" to be<br>
<br>
image->TransformPhysicalPointToIndex( point, newpoint );<br>
<br>
<br>
Also, the filter has settings for the Origin and Spacing of the<br>
output image, but not for its direction.<br>
<br>
It needs something like<br>
<br>
itkSetMacro(Direction, DirectionType);<br>
<br>
in the header file,<br>
<br>
and then in lines 194 in the .txx file<br>
<br>
OutputImage->SetLargestPossibleRegion( region); //<br>
OutputImage->SetBufferedRegion( region ); // set the region<br>
OutputImage->SetRequestedRegion( region ); //<br>
OutputImage->SetSpacing(m_Spacing); // set spacing<br>
OutputImage->SetOrigin(m_Origin); // and origin<br>
<br>
we should add<br>
<br>
OutputImage->SetDirection(m_Direction);<br>
<br>
<br>
----<br>
<br>
<br>
<br>
Would you be interested in adopting this bug ?<br>
<br>
<a href="http://www.itk.org/Wiki/ITK_10th_Anniversary_Activities/Adopt-A-Bug_1.0" target="_blank">http://www.itk.org/Wiki/ITK_10th_Anniversary_Activities/Adopt-A-Bug_1.0</a><br>
<br>
The adoption process<br>
includes full CVS write access to ITK :-)<br>
<br>
<br>
<br>
If so, we will be happy to assist you in the<br>
process of fixing it.<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
------------------<br>
2010/5/26 Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Update: by setting transform matrices to identity in order to experiment<br>
> with them, I notices that my code for using<br>
> DeformableMesh3DFilter was not wrong, but that filter does not respect<br>
> direction cosines either. With identity cosines it worked without weird<br>
> deformations I was experiencing with sagittal images.<br>
> And since many (most?) filters which deal with images ignore direction<br>
> cosines, again we come to the need of having a filter which will reorient<br>
> image pixels in order to have identity cosines matrix (DICOM LPS<br>
> orientation, ITK RAI orientation). And creating this filter does not have to<br>
> be considered admitting "ITK is not perfect", it can be considered as a<br>
> stopgap measure until all filters use TransformPhysicalPointToIndex and<br>
> other built-in transformation routines instead of custom (and incomplete)<br>
> transformation code (such as in TriangleMeshToBinaryImageFilter).<br>
> Regards,<br>
> Dženan<br>
> 2010/5/26 Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>><br>
>><br>
>> Hi everyone!<br>
>> While wrestling with DeformableMesh3DFilter, I wanted to create binary<br>
>> mask of my initial mesh (so I could use it with examples), but I ran into a<br>
>> problem. TriangleMeshToBinaryImageFilter is not designed to produce images<br>
>> with direction cosines matrix different from identity matrix. When I supply<br>
>> it with such an image and mesh which is valid with respect to ITK's physical<br>
>> coordinate handling routines (TransformPhysicalPointToContinuousIndex and<br>
>> friends), it crashes.<br>
>> typedef<br>
>> itk::TriangleMeshToBinaryImageFilter<MeshType,VisualizingImageType><br>
>> MeshFilterType;<br>
>> MeshFilterType::Pointer meshFilter = MeshFilterType::New();<br>
>> meshFilter->SetInfoImage(visualizing); //TransformMatrix = 0 1 0<br>
>> -0.0939968 0 -0.995573 -0.995573 0 0.0939968<br>
>> meshFilter->SetInput(mesh);<br>
>> meshFilter->Update(); //crashes<br>
>> For usage in examples, I can edit my transform matrix in .mha files and<br>
>> set it to identity, but what about normal usage? Is there some quick (and<br>
>> possibly dirty) way to get this right, or do I have to do all the math on<br>
>> paper in order to transform between representations with and without<br>
>> direction cosines?<br>
>> Thanks,<br>
>> Dženan<br>
><br>
</div></div>> _____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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>
</blockquote></div><br>