[Insight-users] Negative values inside a shape using SignedMaurerDistanceMapImageFilter

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Fri Aug 31 06:16:37 EDT 2007


Hi,

Le 31 août 07 à 10:54, Blue Moon a écrit :

> Hi Gaëtan,
>
> Thanks a lot for your reply. That's actually what I thought it  
> should be, but in fact, as I said in the msg, I get zeros in the  
> distance map for these filled pixels. I'd be very grateful if you  
> may give any further advice.
>

I'm sorry, I missed that part of your email.

Your problem may be the effect of the 0 border inside the object.  
Note that because your object is very small, all the pixels in it can  
be considered as pixel on the border.

If you are more interested by the distance inside the object than the  
one outside, a simple method is to tell that the background is your  
object, and that you want the inside values to be positives.

Here is the map I get with a similar image to yours:

8.0     5.0     4.0     4.0     5.0     8.0     13.0    18.0
5.0     2.0     1.0     1.0     2.0     5.0     8.0     13.0
2.0     1.0     -0.0    -0.0    1.0     2.0     5.0     10.0
1.0     -0.0    -0.0    -0.0    -0.0    1.0     4.0     9.0
1.0     -0.0    -0.0    -0.0    -0.0    1.0     4.0     9.0
2.0     1.0     -0.0    -0.0    1.0     2.0     5.0     10.0
5.0     2.0     1.0     1.0     2.0     5.0     8.0     13.0
8.0     5.0     4.0     4.0     5.0     8.0     13.0    18.0


with maurer->SetBackgroundValue(255) and maurer->SetInsideIsPositive 
(true), I get:

2.0     1.0     1.0     1.0     1.0     2.0     5.0     8.0
1.0     0.0     0.0     0.0     0.0     1.0     2.0     5.0
0.0     0.0     -1.0    -1.0    0.0     0.0     1.0     4.0
0.0     -1.0    -2.0    -2.0    -1.0    0.0     1.0     4.0
0.0     -1.0    -2.0    -2.0    -1.0    0.0     1.0     4.0
0.0     0.0     -1.0    -1.0    0.0     0.0     1.0     4.0
1.0     0.0     0.0     0.0     0.0     1.0     2.0     5.0
2.0     1.0     1.0     1.0     1.0     2.0     5.0     8.0

Also, you may want to work at a subpixel resolution to set the limit  
of the object between the white and the black pixels, but in that  
case, the Maurer filter is not the right one, and you may have to  
look at the level set framework (that part is outside of my knowledge).

Gaëtan



> Best,
> BM
>
>
>> From: Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>> To: "Blue Moon" <bluemoon608 at hotmail.com>
>> CC: ITK <insight-users at itk.org>
>> Subject: Re: [Insight-users] Negative values inside a shape using
> SignedMaurerDistanceMapImageFilter
>> Date: Thu, 30 Aug 2007 20:11:03 +0200
>>
>>
>> Hi,
>>
>> In the SignedMaurerDistanceMapImageFilter, the object are not  
>> defined  by their bourders, but by the label of their pixel. All  
>> the pixels  above 0 are inside the object, the other are outside.
>>
>> In your example, the center of the shape is *outside* the object,  
>> and  that's why you get positive values. To get negative values,  
>> you have  to fill your object, for example with the   
>> GrayscaleFillholeImageFilter, before computing the distance map.   
>> Something like:
>>
>> o o o o o o o o
>> o o o x x o o o
>> o o x x x x o o
>> o o x x x x o o
>> o o o x x o o o
>> o o o o o o o o
>>
>> Will give what you want.
>>
>> Regards,
>>
>> Gaëtan
>>
>>
>>
>>
>> Le 30 août 07 à 20:00, Blue Moon a écrit :
>>
>>> Hi,
>>>
>>> I am new to ITK and I am trying to use   
>>> SignedMaurerDistanceMapImageFilter to compute the distance map   
>>> around a shape. My problem with this filter is I always get   
>>> positive values inside the shape. An example is given below:
>>>
>>> For an input shape o o o o o o o o
>>> o o o x x o o o
>>> o o x o o x o o
>>> o o x o o x o o
>>> o o o x x o o o
>>> o o o o o o o o
>>>
>>> I am expecting something like:
>>> 3 2 1 1 1 1 2 3
>>> 2 1 1 0 0 1 1 2
>>> 2 1 0-1-1 0 1 2
>>> 2 1 0-1-1 0 1 2
>>> 2 1 1 0 0 1 1 2
>>> 3 2 1 1 1 1 2 3
>>>
>>> but I get +1 instead of -1 for the internal pixels. When I set  
>>> the  internal 'o' to 'x' in the input image, I get '0' for these  
>>> positions.
>>> Is this what the filter is designed to produce, or I've done   
>>> something wrong?
>>> Any suggestions on how to use this filter will be much  
>>> appreciated.  Thanks in advance.
>>>
>>> BM
>>>
>>> _________________________________________________________________
>>> ä¸Žä¸–ç•Œå„åœ°çš 
>>> „朋友进行交流,å
> è´¹ä¸‹è½? Live
>>> Messenger;  http://get.live.com/messenger/overview
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>> --
>> Gaëtan Lehmann
>> Biologie du Développement et de la Reproduction
>> INRA de Jouy-en-Josas (France)
>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>> http://voxel.jouy.inra.fr
>>
>>
>>
>
>
>> << PGP.sig >>
>
> _________________________________________________________________
> ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN  
> Hotmail¡£ http://www.hotmail.com

--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070831/cbf09d2f/PGP-0001.pgp


More information about the Insight-users mailing list