How to measure the maximum value of a segmented ROI in ITK-snap? - image-segmentation

How to measure the maximum value of a segmented ROI in ITK-snap?
After segmentation, I can only get mean and SD from the Volumes and Statistics.

I guess that ITK-SNAP does not expose maximum value of base image in a segment. You might want to use 3D Slicer, and its segment statistics module.

Related

Increase size of individual connected component in a binary image (BW) when using regionprops

I am using imregionalmax to create a binary image BW that identifies the regional maxima in my image.
Next I want to use regionprops with property WeightedCentroid to identify the coordinates of the centroid centers in the image. However, imregionalmax returns a binary image with very small connected components, which need to be increased in dimension to enable regionprops to weigh the centroid properly.
Possible solutions:
I believe the ideal situation would be to interrupt the regionprops operation at each iteration, and simply increase the size of the current connected component that it is working with by adding a couple of pixels in height and width to it.
In case this is not possible, a work around could be to split BW into an image stack with only a single connected component in each slice, expand each component by some pixels, and run regionprops individually on each image slice. This does not seem like a efficient way of solving this though.
Is there another more efficient way, and how would I implement that?
** I am aware that one way of increasing the connected components in BW is to use imdilate, but this will lead to unconnected components becoming connected.
** Another option is to use bwmorph with property thicken, which performs very well, however in a case where multiple components are close together, the size cannot be increased in one direction and reduce the performance of WeightedCentroid.
You cannot increase measurement accuracy by extending what you want to measure...
Centroid is simply the average of all region coordinates.
WeightedCentroid only takes intensities into account in case you don't have a binary image.
If you increase your object by whatever algorithm you like you risk shifting your centroid away from its true position!

in matlab, find 3D neighbourhood

I have a volume (3D matrix) that has undergone a segmentation process. Most of the volume consist of NaNs (or zeros), except regions that have passed some criteria (see picture). I need to know how large each remaining segment is in number of voxels and how is their distribution on the 2D planes (xy, xz, yz). Is there anything in matlab that can help me do this in an efficient way rather than direct search? The volume can be rather large. For ex. in the attached picture there is one segment in yellowish/brownish colour of 7 voxels and extends more vertically than in xy.
Thanks in advance.
The most convenient solution is to use REGIONPROPS. In your example:
stats = regionprops(image, 'area', 'centroid')
For every feature, there is an entry in the structure stats with the area (i.e. # of voxels) and the centroid.
I think that what you are looking for is called bwlabeln. It allows you to find blobs in 3D space, just like bwlabel does in 2D. Afterwards, you can use regionprops to find out the properties of the data.
Taken directly from help:
bwlabeln Label connected components in binary image.
L = bwlabeln(BW) returns a label matrix, L, containing labels for the
connected components in BW. BW can have any dimension; L is the same
size as BW. The elements of L are integer values greater than or equal
to 0. The pixels labeled 0 are the background. The pixels labeled 1
make up one object, the pixels labeled 2 make up a second object, and
so on. The default connectivity is 8 for two dimensions, 26 for three
dimensions, and CONNDEF(NDIMS(BW),'maximal') for higher dimensions.

how to find holes in objects in matlab image?

is it possible to find holes in connected components, i.e in objects in an image. if so, can we also count holes? Like, I have used cc = bwlabel(image); to do connected components labeling. Now, how to find number of holes in each object ?
You could use the Euler characteristic. From the Matlab documentation:
The bweuler function returns the Euler number for a binary image. The Euler number is a measure of the topology of an image. It is defined as the total number of objects in the image minus the number of holes in those objects. You can use either 4- or 8-connected neighborhoods.
But be aware that a single pixel "hole" can change the Euler characteristic. You might want to use some opening/closing to smooth object outlines before using bweuler.
A hole is the presence of nothing, so you can just invert the image and then count connected components.

Texture analysis on irregular region of interest

I have an image which I would like to extract the GLCM texture in an area of interest(AOI). But AOI is a non-rectangular shape.
As an image is always stored as a matrix in Matlab, even if the AOI is an irregular polygonal area the neighboring pixels will also have to be used to make it a rectangular region. Since all the pixels outside the area of interest are made equal to zero, does this affect the features extracted from texture analysis.
Is it possible to do any kind of image analysis on non-rectangular regions?
Yes, if the pixels outside the area of interest were being used when computing the gray level cooccurrence matrix, then the result would be incorrect -- that is, would not suit your requirements, as border processing is a matter of choice.
Existing software systems offer this feature:
If you use matlab, according to http://www.mathworks.com/help/toolbox/images/ref/graycomatrix.html, you would need to assign to the pixels of the input image which are outside the AOI the value Nan.
In Mathematica, very conveniently the function ImageCooccurrence has an option named Masking which allows to pass any AOI as a binary mask. From http://reference.wolfram.com/mathematica/ref/ImageCooccurrence.html:

Autothreshold Formula Modification in Simulink (Matlab)

I have make the model in simulink using Video and Image Processing Blockset for classifying the image and convert into binary image using Autothreshold. In Autothreshold I am able to change the Threshold value. But I am not be able to change the formula of Autothreshold. Is there any way to change the formula of calculation Threshold?
There doesn't appear to be any way to change the formula used by the Autothreshold block to calculate an image threshold (it uses Otsu's method). The only option you have is to add a scaling factor to the calculated threshold by setting the Scale threshold parameter in the block dialog box.