[ITK-users] [ITK] How to generate asymmetric line structuring element?

Timothee Evain tevain at telecom-paristech.fr
Thu Jul 9 05:04:16 EDT 2015


Hello Weldon,

To the best of my knowledge, there is no automatic tool for generating asymmetric structuring element (SE).
You have to define your SE yourself as a Neighborhood with desired pixels set as >0. To access easily these pixels, use the Offset.
Here an example  :

itk::Neighborhood<float,2> SE;
SE.SetRadius(RadiusValue); //let's say RadiusValue==2 for this example, so a 5x5 SE
SE[SE.GetCenterNeighborhoodIndex]=1; //Here you set the center pixel "ON"

//Define which pixel you want to be "ON"
itk::Offset<2> Off1X={1,0};
itk::Offset<2> Off2X={2,0};
itk::Offset<2> Off1Y={0,1};
itk::Offset<2> Off2Y={0,2};

//Set the pixel of the neighborhood to "ON"
SE[Off1X]=1;
SE[Off2X]=1;
SE[Off1Y]=1;
SE[Off2Y]=1;

This will give you this SE:

0	0	1	0	0
0	0	1	0	0
0	0	1	1	1
0	0	0	0	0
0	0	0	0	0

So basically, if you dilate, this will be toward positive X and Y only
Use it as any other structuring element in the filter, for example :

itk::BinaryDilateImageFilter<InputImageType,OutputImageType,itk::Neighborhood<float,2>>::Pointer DilateFilter=
itk::BinaryDilateImageFilter<InputImageType,OutputImageType,itk::Neighborhood<float,2>>::New()
DilateFilter->SetKernel(SE);
....etc

I know this could be a bit heavy to do, but it works.

Hope this helps,

Tim

----- Mail original -----
De: "zagwin" <zagwin at gmail.com>
À: insight-users at itk.org
Envoyé: Jeudi 9 Juillet 2015 01:24:33
Objet: [ITK] [ITK-users] How to generate asymmetric line structuring	element?

Dear All,

I want to generate asymmetric line structuring elements for Dilate and Erode
operations.
An example is (1 1 1 0 0)^T

I did it as 
typedef itk::FlatStructuringElement       <2>                
FlatStructureType;
FlatStructureType element2;
FlatStructureType::RadiusType rad;
rad[0] = 0;
rad[1] = 2;
element2 = FlatStructureType::Box(rad);

Now I get a (1 1 1 1 1)^T, is it possible to set the last two item to false?

Or is there other method to generate what I want? thanks very much

Best
Weldon



--
View this message in context: http://itk-users.7.n7.nabble.com/How-to-generate-asymmetric-line-structuring-element-tp35881.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
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.php

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://public.kitware.com/mailman/listinfo/insight-users
_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community


More information about the Insight-users mailing list