Creating binary 3D mask from MR volume

Hello All,
I am trying to create a 3D binary mask for MR head volume. The image has 0 intensity for background and the tissue inside the image has integers. Morphological operations provide me very noisy output.
This is after bwconncomp, thresholding and imerode options.
Are there better ways to get volumetric masks?

8 commentaires

darova
darova le 26 Avr 2020
What about imdilate?
I have run image dilation operation too. Is there a way to use image gradient?
[gx,gy,gz] = imgradientxyz(mr,'prewitt');
mr_grad = sqrt(gx.^2+gy.^2+gz.^2);
Because the above code generates pretty good boundary of the head.
Then something like imfill or so to fill eveything inside the outer 3D surface or boundary.
What about binarization? Did you try small threshold?
load clown
rgb = ind2rgb(X,map); % convert indexed image to RGB
I = im2bw(rgb,0.2); % binarize
imshowpair(rgb,I)
@darova, what is X in the second line? Is it the 3D MR image? I am having the following error:
>> rgb = ind2rgb(mr, map);
Unable to perform assignment because the size of the left side is 170-by-256 and the size of the right side is 170-by-256-by-256.
>> numel(unique(mr))
ans =
562
0 is the background in the mr 3D image. Is it the code you've written for binarization? The first 3D image I shared is taking all the intensities above 12.
Image Analyst
Image Analyst le 26 Avr 2020
It might not matter that it's "noisy". What do you plan on using the mask for?
banikr
banikr le 27 Avr 2020
Modifié(e) : banikr le 27 Avr 2020
Having the mask will allow me to assign segmentation labels on unsegmented tissues in lower jaw section of the image.
As you can see the inferior(lower) jaw sections are only segmented with fat tissue(blue). I want to assign rest of the tissues as skin and muscle(though there are bones and cartilages and other tissues too).
So suppose I have a binary 3D mask.
% selecting the jaw slices as lab
lab(lab==0 & mask==1) = 10; % skin and muscle label is 10
resulting in labeling for the whole head tissues.
Image Analyst
Image Analyst le 27 Avr 2020
I don't think the noise on the mask is the issue. Why did your classification routine quit classifying stuff below that line other than the blue stuff? For some reason, you have a mask that just quits below that line, and that has nothing to do with little noisy blips on it.
banikr
banikr le 27 Avr 2020
Yeah you are right, the noise has nothing to do with the classification.
The classification comes from CT image which only exists for the segmented section. Now for MR images there is no specific intensity scaling mechanism like CT. For my experiment, I also need the inferior section of the head labelled in MR space.
CT image was registered on MR space.

Connectez-vous pour commenter.

Réponses (2)

Hello banikr,
I think this is what you want ... if I am not wrong.
load mri;
% load mriVolume; %3D MRI data with data variable name 'mriVolume'
mriVolume = D;
% Assuming background pixels are 0
bwMask = false(size(mriVolume));
pixIndex = find(mriVolume > 0);
bwMask(pixIndex) = 1;

3 commentaires

banikr
banikr le 27 Avr 2020
@Mrutyunjaya,
I understand what you are trying to say. But I have already performed the zero based thresholding and the output is too noisy and I want to smoothed out image. The 3D image I uploaded at first thresholds intensities at 12. Still noisy at skin and surface periphery of the volume.
@ banikr,
ok got it, if MRI data is possible to share, please share. love to work on it.
banikr
banikr le 27 Avr 2020

Connectez-vous pour commenter.

banikr
banikr le 29 Avr 2020
I just wanted to update the finding I have(following mask image).
I used the intensity 10 for thresholding and removed objects with area under 1000.
bi = (mr>10);
% volumeViewer(bi);
stat = regionprops(bi, 'Area', 'PixelIdxList');
for nn=1:length(stat)
s = stat(nn);
if s.Area<1000
continue;
end % remove small objects
bi = zeros(sz);
bi(s.PixelIdxList) = 1;
end
volumeViewer(bi);
I tried to explain the value 10.
J = mr(mr~=0);
>> SkinMusclePrc = prctile(J,[20, 100], 'all')
SkinMusclePrc =
2×1 int16 column vector
10
626
The value 10 is on 20 percentile of the distribution.
let me know if that helps your search also.

Question posée :

le 26 Avr 2020

Réponse apportée :

le 29 Avr 2020

Community Treasure Hunt

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

Start Hunting!

Translated by