Azzera filtri
Azzera filtri

How to display images from nifti file format in Matlab?

149 visualizzazioni (ultimi 30 giorni)
I have a COVID-19 CT segmentation dataset where all images are in .nii file format. Each image file has mulitple slices (512*512*100). Using niftiread command Matlab i read the image file and now I want to visualizing each of the 100 slices one by one in Matlab.
The dataset is available on the site http://medicalsegmentation.com/covid19/
  1 Commento
Tanguy
Tanguy il 14 Set 2020
Modificato: John Kelly il 7 Dic 2023
imtool3D_td would perfectly fit your needs, and also display Mask with edit tools (ex: brush tool).
Simply run the following command after adding imtool3D_td to your Matlab path:
V = niftiread('niftifile.nii')
Mask = niftiread('mask.nii')
tool = imtool3D(V);
tool.setMask(Mask);
Use scrollwheel to go through slices.
You should get this :
Other examples on the github page or the help function of imtool3D.m Good luck
Hope that helps!

Accedi per commentare.

Risposte (1)

Emerson Nithiyaraj
Emerson Nithiyaraj il 20 Mag 2020
After you read the Nifti file using niftiread, you could visualize each slice one by one using the below command,
V = niftiread('niftifile.nii');
c = V(:,:,n); %n is the slice number that you want to visualize.
imshow(c,[])
Or else there is an online tool ,Papaya: a pure JavaScript medical research image viewer, supporting DICOM and NIFTI formats, compatible across a range of web browsers. So this is like an radiologist assist tool where you could have a better understanding about the nifti file here rather than reading slices one by one using Matlab.
  2 Commenti
Diannira Sasri Apsari
Diannira Sasri Apsari il 3 Set 2020
I need to display .nii file on specific slice but the output is blank. How to solve it?
This is my code
for j=3
V = niftiread('label0001.nii');
info = niftiinfo('label0001.nii');
refImage = V(:,:,j);
imshow(refImage,[])
title('Ground Truth Image');
end
Emerson Nithiyaraj
Emerson Nithiyaraj il 4 Set 2020
You have used 'j' as the slice number. So 'j' denotes the particular slice number that you want to display. For example if you want to display the 100th slice;
Try this code
V = niftiread('label0001.nii');
info = niftiinfo('label0001.nii');
j = 100;
refImage = V(:,:,j);
imshow(refImage,[])
If you want to display groundtruth try,
V = niftiread('label0001.nii');
info = niftiinfo('label0001.nii');
j = 100;
refImage = V(:,:,j);
imshow(refImage)
Still if you have problem, convert the data format of the particular slice to int16 or int8.
Please let me know the feedback.

Accedi per commentare.

Categorie

Scopri di più su MRI in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by