Why do I receive the error message "sliceViewer requires 3-D grayscale(MxNxP) or 3-D RGB volume(MxNxPx3) with no singleton dimensions"?

5 views (last 30 days)
I am using the following code to load a stacks of CT images for 3D multiplanar and volume viewing. All my images are of dicom format images without the .dcm extension.
I try to use the following code to open my images.
dataFolder = fullfile("folder_name");
sourceTable = dicomCollection(dataFolder);
medVol = medicalVolume(sourceTable);
My medVol function gives the following result:
medVol =
medicalVolume with properties:
Voxels: [512×512 uint16]
VolumeGeometry: [1×1 medicalref3d]
SpatialUnits: "mm"
Orientation: "transverse"
VoxelSpacing: [1 1 1]
NormalVector: [0 0 1]
NumCoronalSlices: 512
NumSagittalSlices: 512
NumTransverseSlices: 1
PlaneMapping: ["sagittal" "coronal" "transverse"]
Modality: "CT"
WindowCenters: 200
WindowWidths: 50
sliceViewer(medVol)
My sliceViewer returned the following error message:
"Error using images.stacks.browser.internal.SliceViewer/validateVolume
sliceViewer requires 3-D grayscale(MxNxP) or 3-D RGB volume(MxNxPx3) with no singleton dimensions.
Error in images.stacks.browser.internal.SliceViewer/loadData
Error in sliceViewer"
Why my dicom images does not contain 3D grayscale or 3D RGB volume?
I tried to search online for ways to convert such images to grayscale or RGB but to no avail. I only get search results on conversion of grayscale to RGB and vice versa. Is there any way to convert my dicom images to 3D grayscale or 3D RGB volume? Any help is very much appreciated. Thank you.

Accepted Answer

Matt J
Matt J on 1 May 2023
Edited: Matt J on 1 May 2023
I see nothing in your code that would be expected to access the numeric content of the DICOM files. You should probably be using dicomreadVolume to read in your data, perhaps
V = dicomreadVolume(sourceTable)
But even then, you should check what is being read in, and if it indeed has the form of a numeric volume array,
whos V

More Answers (0)

Categories

Find more on Medical Physics in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!