Hi Ged,
When I wrote a program that segments 3D images, I had the same problem:
sometimes you want to (i) make connected components of all the connected
regions that have the same grey values (meaning that two 'zero' regions
get different labels) and sometimes you only want to (ii) consider
'nonzero' regions (that gives all the 'zero' regions the same label
-possibly zero).
Examples of the two cases are (i) labellings of connected anatomical
brain regions and (ii) labellings of activation clusters.
If zeros were not ignored in case (ii), then active voxels surrounded by
active voxels, would be labelled as active regions.
I don't know the FSL code well enough to comment, but once you have the
region labels and their volumes, then sorting the {volume,region} pairs
by volume and rewrite the labels volume, would be very easy and fast.
The code to do this would be after the segmentation.
hth
Alle Meije
Ged Ridgway wrote:
> Hi,
>
> I have a couple of questions about connectedcomp.
>
> It seems to ignore zeros, in the sense that any zeros in the input are
> left as zeros in the output, and hence the "zero-component" is not
> necessarily connected. Is that true? It seems that if I add 1 to the
> image with avwmaths before running connectedcomp, then the
> "one-component" is connected, as expected.
>
> Are the components sorted in terms of number of voxels? It seems from
> the limited data that I've looked at that the lowest numbered CC
> (respectively zero and one above) is the largest CC, followed by the
> second largest, and so on. But I wanted to double check this.
>
> I've had an attempt at looking through the code, which appears to be
> spread between $FSLDIR/src/newimage/newimagefns.cc and newimagefns.h,
> but I'm struggling with the lack of comments, so I thought I'd see if
> anyone at FMRIB knew from memory, or if any frequent users knew from
> experience.
>
> Many thanks,
> Ged.
>
|