[Insight-users] to divide images

Zachary Pincus zpincus at stanford.edu
Thu, 29 Apr 2004 11:13:12 -0700


Sorry if I wasn't clear (which I may not have been, looking at my last =20=

email).

The code I sent out is a function that takes a 1/0 binary mask, finds =20=

connected regions in the mask (either face or fully connected, =20
according to a flag), and extracts each region into a "sub-mask" that =20=

contains only the pixels for that connected region, on an otherwise =20
black background. A vector of these "sub masks" is returned.

This code doesn't inherit from any of the ITK classes, but the guts are =20=

mostly yanked from the ConnectedComponentImageFilter.

I'd be happy to whip this code into shape for submission to ITK, if =20
that's something that people would find useful, or have asked for =20
before.

Zach


On Apr 29, 2004, at 10:53 AM, Zachary Pincus wrote:

> Hi,
>
> I've modified the itk::ConnectedComponentImageFilter to return a =20
> vector of "submasks" -- that is, images corresponding to each =20
> connected blob. If you want to know where the image belonged in the =20=

> original, the index of the region of the returned image will tell you =20=

> where that sub-mask came from in the original. This code is attached.
>
> This code is NOT in ITK form -- it's not a filter, or even a class of =20=

> any kind. Just a hunk of procedural code. If people want, I could try =20=

> to make it into an ImageToImage filter subclass for submission to ITK. =
=20
> Is this something that would be valuable to others? Let me know.
>
> Zach Pincus
>
> Department of Biochemistry and Program in Biomedical Informatics
> Stanford University School of Medicine
>
> PS. I also wrote some code that takes a binary mask and extracts the =20=

> region of an image corresponding to the mask (even if the mask is =20
> smaller than the image), optionally rotating it to the principal axes =20=

> of the mask. Let me know if you want this too.
>
> <GetConnectedMasks.h><GetConnectedMasks.txx>
>
> On Apr 29, 2004, at 10:20 AM, David Llanos wrote:
>
>> Hi all,
>> =A0
>> I am looking for classes and methods to divide a binary image in =20
>> several binary images, in function of the I number of objects that =20=

>> the original binary image has. For example, of the image binar.png, =20=

>> to obtain four images like uno.jpg.
>> I have gotten the first requirement for this objective that is to =20
>> label this objects, by means of the following code:
>> ...
>> I have been looking for some relabeller or labeller method=A0 (in =20
>> http://www.itk.org/Insight/Doxygen/html/=20
>> classitk_1_1RelabelComponentImageFilter-members.html and in =20
>> http://www.itk.org/Insight/Doxygen/html/=20
>> classitk_1_1ConnectedComponentImageFilter-members.html) to go keeping =
=20
>> the different objects of the image in pointers, either to write files =
=20
>> or to work with them for separate, but I have not found anything with =
=20
>> that that to be able to work.
>> does some form exist of using these classes for my objective, or do I =
=20
>> have to use another class? In that case, What relabeller or labeller =20=

>> method=A0 can I use to relate an object labeled with another class?
>>  =A0
>> Thanks inadvange and regards,
>> =A0
>> David.