[Insight-users] Submission: FullyConnectedImageFilter to complement ConnectedComponentImageFilter

Zachary Pincus zpincus at stanford.edu
Sun, 15 Feb 2004 20:10:10 -0800


--Apple-Mail-25--186836760
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Hello,

Here is an image filter that labels thin contours in binary images.

While ITK includes a ConnectedComponentImageFilter, this filter only 
works for face-connected objects (in 2-d, that's 4-connected), such as 
blobs. For single-pixel-thick contours, one needs to trace all the 
diagonal connections too (in 2-d, that's 8-connected), so this filter 
is not sufficient.

I have modified itkConnectedComponentImageFilter to trace contours 
across diagonals and faces in n dimensions. (It was a simple, but not 
totally trivial modification.) Here is my code, in case anyone needs 
it, or the ITK maintainers feel that it would be worth including in the 
repository.

(Note that I tried to integrate this into the original 
itkConnectedComponentImageFilter code to avoid excess code duplication, 
but that became really kludgy and unworkable due to the interface 
differences between ShapedNeighborhoodIterator::Iterator and 
Neighborhood::Iterator -- this is a bit of a pain, really.)

Also, in the future, what is the preferred method of code submission?

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine


--Apple-Mail-25--186836760
Content-Transfer-Encoding: base64
Content-Type: application/x-gzip;
	x-unix-mode=0644;
	name="itkFullyConnectedImageFilter.tgz"
Content-Disposition: attachment;
	filename=itkFullyConnectedImageFilter.tgz

H4sIAAAAAAAAA+0aa0/bSpbP+RWnXIlNKIRQCkiBItHetkLb0gqo7tXqStUQT5JZHI9rjwm0Yn/7
njMPe/wICXer7hcfVQ22z5w578fYQt28y8Lw/o2MIj5SPDibsQl/J0LFk521nwODwcvB4f4+/g4G
hwfmd/Dipfk1sLY7GOy+RLyDw4O1we7B7uH+Guz/pP0fhSxVLAFY+x6LaJSlC/EQbTz+FQz9WhCP
2b/28I2cxTLikfKw+tNlewzQuAcvX5bsv/ti4Ox/cIg2d/bf23uxNnixf7j/cg0Gv0IBq9qfBTMR
/QqGfi10fhPjKOBj+Pp1JWt/nXZ+Q3QR8SeswE2i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