[Insight-users] Calculation of the distance between the 2 farthest voxels of an image

Richard Beare richard.beare at gmail.com
Sun Jun 12 19:58:00 EDT 2011


If this is something you want to do very often then you probably want
a convex hull, then a brute force test of the hull vertices. VTK has
classes that compute convex hulls.

If it is a once off, then use the code that has already been sent. If
it seems to be taking too long, then make sure you filter the input
image first to remove voxels that aren't edges of the mask.

On Mon, Jun 13, 2011 at 5:49 AM, Neil Panjwani <paniwani at gmail.com> wrote:
> You can brute force and compute the distance between every white pixel, but
> its not that efficient. See the attached file.
>
> On Sun, Jun 12, 2011 at 9:58 AM, Pedro Névoa <pedronevoa at gmail.com> wrote:
>>
>> Hi,
>>
>> I forgot one detail. Not the distance between any voxels, but the distance
>> between the 2 white (255) farthest voxels on a black (0) background!
>>
>> Thank you.
>>
>> Regards,
>>
>> 2011/6/12 Terry Yoo <tyoo at mail.nih.gov>
>>>
>>> Pedro:
>>>
>>> x^2 + y^2 + z^2 = d^2
>>>
>>> Simply:  The farthest distance is from one corner to the opposite corner
>>> of a rectangular volume.
>>>
>>> max-distance = Sqrt((x-max * x-max) + (y-max * y-max) + (z-max * z-max))
>>>
>>> Or am I missing something, Pedro?  Were you asking something else?
>>>
>>> -Terry
>>>
>>> Terry S. Yoo, PhD
>>> Office of High Performance Computing and Communications
>>> National Library of Medicine
>>> National Institutes of Health
>>> tyoo at mail.nih.gov
>>>
>>>
>>>
>>> On Jun 11, 2011, at 4:54 PM, Pedro Névoa wrote:
>>>
>>> > Hello,
>>> >
>>> > Does anyone know a method to calculate the distance between the 2
>>> > farthest voxels of an image?
>>> >
>>> > Thank you.
>>> >
>>> > Regards,
>>> >
>>> > --
>>> > Pedro Névoa
>>> >
>>> > <ATT00001..txt>
>>>
>>
>>
>>
>> --
>> Pedro Névoa
>>
>>
>> _____________________________________
>> 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
>
>


More information about the Insight-users mailing list