[ITK Community] [Insight-users] Creating a line structuring element
Emma Ryan
eryanvtk at yahoo.com
Wed Feb 19 15:23:03 EST 2014
Hi Richard,
Thank you for your reply. That works. My dilema was which member variable allows me to set a radius and which one allows me to set the dimension. Dimension is inherent for flat structural type. Your reply clarifies that.
thanks,
Emma
On Tuesday, February 11, 2014 5:16 PM, Richard Beare <richard.beare at gmail.com> wrote:
Hi,
Assuming that you want a line parallel to one of the axis, then your best bet is probably to start with the box element, as you have. I think it is meant to fall through the zero dimensions. You'll need to confirm this.
The polygon structuring element and box structuring elements both use line structuring elements internally.
Structuring element code can look something like this:
typedef itk::FlatStructuringElement< 2 > SRType;
// rad will be length 2
SRType::RadiusType rad ;
// individually set elements - .Fill will set them all
rad[0]=5;
rad[1]=0;
// now create a box element with these sizes
SRType kernel;
kernel = SRType::Box(rad);
// use it with a filter
typedef typename itk::GrayscaleErodeImageFilter<TImage, TImage, SRType> FiltType;
typename FiltType::Pointer filt = FiltType::New();
filt->SetInput(input);
filt->SetKernel(kernel);
filt->SetAlgorithm(FiltType::VHGW);
On Wed, Feb 12, 2014 at 11:42 AM, Emma Ryan <eryanvtk at yahoo.com> wrote:
Hi,
>
>
> How does one create a line structuring element. I would like to create a [1, 5] size vector so to speak and use that as a structuring element.
>I guess I have to use itk::FlatStructuringElement<2> and StructuringElementType::Box(..)
>
>
>But beyond that, how does one set the size ? From a default radius of 1 (3 x 3) I would like a (1 x 5) or should it be (0 x 5) size structural element.
>
>
>The following does not work. It gives a syntax error on SetSize and frankly I dont think syntax is the only issue.
>
>
>
>
>
>unsigned int radius = 2;
> typedefe itk::Size<2> SizeType;
> SizeType strelSize;
> strelSize[0] = 1;
> strelSize[1] = 5;
>
> typedef itk::FlatStructuringElement<2>
StructuringElementType;
> StructuringElementType::RadiusType elementRadius;
> elementRadius.Fill(2);
> elementRadius.SetSize(strelSize);
> StructuringElementType strel = StructuringElementType::Box(elementRadius);
>
>
>
>
>
>thank you,
>Emma
>
>_____________________________________
>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://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140219/e793bd0a/attachment-0002.html>
-------------- next part --------------
_____________________________________
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://www.itk.org/mailman/listinfo/insight-users
More information about the Community
mailing list