Binarize a 3D image

Hello, What parameters would need to be changed or what code would you use in order to binarize a 3d .nii image (NIFTI image)?
Please and Thank you!

Answers (2)

Nothing really, if you're just thresholding. If you're using a more powerful binarization technique (threshold on something cooler) then you might need to augment the cooler method to work through slices or on volumes .
%Ex binarize:
%%2D
I = imread('cameraman.tif');
subplot(121);
imshow(I);
title('Original Camera Dude');
subplot(122)
imshow(I>65);
title('Camera Dude > 65');
%%3D
V = load('mri');
V = squeeze(V.D);
H = msgbox(sprintf('Click Ok! to begin.\nThe first part is the original mri image sequence\nThe second part is it binarized at 30 or greater\nNOTE: The binarized part is converted back to uint8 for implay''s sake'));
uiwait(H)
implay(cat(3,V,uint8((V>=30)*255)));
Walter Roberson
Walter Roberson on 2 Dec 2011

0 votes

Your previous question (ANALYZE images) had the requirement that each different white-matter area should have a separate mask. When you extend to 3D, are you looking to create 3D ROIs where the program continues individual ROIs through multiple layers, and could end up with using the same ROI for two visually separated areas on a slice because the areas are connected at a different slice ?
If so, if you want 3D connections, then the first question to ask is whether the images are already registered or not. If not, then you will have to do an image registration procedure. Depending on your needs, that might involve only translations, or might involve rotations too, or might involve image warping. For example, a blood vessel could in theory impose some local physical distortion if the timescale of the 3D sweep was sufficiently long.
There are different thresholding routines to binarize. Some are pure numeric; others take in to account gradients or textures in order to try to determine boundaries in gray-scale areas, especially if different areas might be touching (e.g watershed algorithms.) There isn't really any "right" way to do this.
Once you have everything registered and binarized, you should be able to use bwlabeln() to find the distinct 3D ROIs.

Categories

Asked:

on 2 Dec 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!