[Insight-users] The Hough transform and world/pixel coordinates

Luis Ibanez luis.ibanez at kitware.com
Sat Feb 6 12:39:06 EST 2010


Hi Alberto,

Thanks for looking at logging an entry in the bug tracker.

Once you are logged in the system:
   http://public.kitware.com/Bug/my_view_page.php

Click on the "Report Issue" link

This link is in the toolbar at the top of the page. From
left to right you will see the following link options:


Main | My View | View Issues | Report Issue | Change Log
 | Roadmap | Summary | Docs | Manage | Edit News |
My Account | Logout


Click on  "Report Issue"

That will bring you to the following page:

    http://public.kitware.com/Bug/bug_report_page.php


Please let us know if you find any problem,


    Thanks for helping us improve ITK !


         Luis


-----------------------------------------------------------------------
On Mon, Feb 1, 2010 at 7:43 AM, Gomez, Alberto <alberto.gomez at kcl.ac.uk> wrote:
> Hello Luis,
>
> I have been trying to log a feature request but I don't find out how. I
> already logged in as Alberto Gomez but still don't find where to click to
> create a new issue.
>
> Thanks,
>
> Alberto
>
>
> Luis Ibanez wrote:
>>
>> Markus, Alberto,
>>
>> Would you like to log a feature request in the bug Tracker,
>>
>> http://public.kitware.com/Bug/my_view_page.php
>>
>> for adding to this filter the functionality of computing the
>> line parameters in physical coordinates ?
>>
>>
>>     Thanks
>>
>>
>>           Luis
>>
>>
>> -------------------------------
>> On Wed, Jan 27, 2010 at 12:10 PM, Markus Neuner <neuner.markus at gmx.net>
>> wrote:
>>
>>>
>>> Hi Alberto,
>>>
>>> Nice that this solved your problem. I agree with you that every filter
>>> that produces points as output should use coordinates in physical space.
>>> I dont know why the itkHoughTransform2DLinesImageFilter outputs
>>> (index)points.
>>>
>>> Best regards,
>>> Markus
>>>
>>> Gomez, Alberto wrote:
>>>
>>>>
>>>> Thanks Markus,
>>>>
>>>> Using ContinuousIndex worked. Nevertheless, I still think that any itk
>>>> Filter should always work in physical coordinates... Is there any
>>>> reason why this filter does not, or is just for implementation
>>>> easiness or efficiency?
>>>>
>>>> Markus Neuner wrote:
>>>>
>>>>>
>>>>> Hi Alberto Gomez,
>>>>>
>>>>> When you take a look at the source code of
>>>>> "Insight/Code/BasicFilters/itkHoughTransform2DLinesImageFilter.txx"
>>>>> starting at line 298 you can see how the points are calculated:
>>>>>
>>>>> ...
>>>>>        LineType::PointListType list; // insert two points per line
>>>>> ...
>>>>>        double radius = it_input.GetIndex()[0];
>>>>>        double teta   =
>>>>> ((it_input.GetIndex()[1])*2*nPI/this->GetAngleResolution())-nPI;
>>>>>        double Vx = radius*vcl_cos(teta );
>>>>>        double Vy = radius*vcl_sin(teta );
>>>>>        double norm = vcl_sqrt(Vx*Vx+Vy*Vy);
>>>>>        double VxNorm = Vx/norm;
>>>>>        double VyNorm = Vy/norm;
>>>>> ...
>>>>>          LinePointType p;
>>>>>          p.SetPosition(Vx,Vy);
>>>>>          list.push_back(p);
>>>>>          p.SetPosition(Vx-VyNorm*5,Vy+VxNorm*5);
>>>>>          list.push_back(p);
>>>>> ...
>>>>>
>>>>> Furthermore the points are of type "itk::LineSpatialObjectPoint<
>>>>> TPointDimension >" whith "typedef Point
>>>>> <http://www.itk.org/Doxygen/html/classitk_1_1Point.html>< double,
>>>>> TPointDimension > PointType".
>>>>>
>>>>> <http://www.itk.org/Doxygen/html/classitk_1_1LineSpatialObjectPoint.html#993f2f73923d9e4fc69f18ca6ac95ea4>
>>>>>
>>>>>
>>>>> As you can see the coordinates are of type double.
>>>>>
>>>>> The easiest solution is to construct a
>>>>>  itk::ContinuousIndex
>>>>> <http://www.itk.org/Doxygen/html/classitk_1_1ContinuousIndex.html>
>>>>> (should be defined in the ImageType::ContiunuousIndexType)
>>>>> and pass it to
>>>>> TransformContinuousIndexToPhysicalPoint (const ContinuousIndex<
>>>>> TCoordRep, VImageDimension > &        index, Point< TCoordRep,
>>>>> VImageDimension > &  point ).
>>>>>
>>>>> I hope this helps.
>>>>>
>>>>> Best regards,
>>>>> Markus
>>>>>
>>>>>
>>>>>
>>>>> Gomez, Alberto wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I am using the itk::HoughTransform2DLinesImageFilter  to extract the
>>>>>> lines from an image for a certain application. The point is that I
>>>>>> don't want to draw the lines but to get the lines parameters
>>>>>> (direction and a point ) for further computations. I realised that,
>>>>>> following the example from the software guide, the vector and the line
>>>>>> are in pixel coordinates and not in real world coordinates. Can anyone
>>>>>> confirm this?
>>>>>>
>>>>>> So, what I did is to use the TransformIndexToPhysicalPoint() method,
>>>>>> but it does not work properly (mi lines are slightly deviated). My
>>>>>> assumption is that the extracted points are in pixel coordinates but
>>>>>> aren't integers. Because of that, the TransformIndexToPhysicalPoint()
>>>>>> method rounds them and then computes the physical coordinates, which
>>>>>> yields in the inaccuracy I realized.
>>>>>>
>>>>>> The solution I found was to get two points, in pixel coordinates, very
>>>>>> far from each other, so that the inaccuracy of the conversion is
>>>>>> smaller. Nevertheless, this is not clean. Does anyone know a way to
>>>>>> get the line parameters accurately in physical coordinates? I guess
>>>>>> that the Hough map (output of the filter) is (r, theta) in real
>>>>>> physical coordinates, but I don't know how to extract the maximums in
>>>>>> the same way that getLines() does (using the disc, etc).
>>>>>>
>>>>>> Thank you,
>>>>>> Alberto
>>>>>> ||
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Alberto Gómez
>>>>>>
>>>>>> /Division of Imaging Sciences
>>>>>> The Rayne Institute
>>>>>> 4th Floor, Lambeth Wing
>>>>>> St Thomas' Hospital
>>>>>> London SE1 7EH /
>>>>>>
>>>>>> phone: +44 (0) 20 718 88364
>>>>>> email: alberto.gomez at kcl.ac.uk <mailto:alberto.gomez at kcl.ac.uk>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>> _____________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>>> http://www.kitware.com/products/protraining.html
>>>>>>
>>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>
>
> --
>
> Alberto Gómez
>
> /Division of Imaging Sciences
> The Rayne Institute
> 4th Floor, Lambeth Wing
> St Thomas' Hospital
> London SE1 7EH /
>
> phone: +44 (0) 20 718 88364
> email: alberto.gomez at kcl.ac.uk <mailto:alberto.gomez at kcl.ac.uk>
>
>


More information about the Insight-users mailing list