Regarding import

Operating system: windows 10 64 bit
Slicer version: 4.9 nightly
Expected behavior: import .mat file
Actual behavior: doesn’t import

Hi folks,

I have some Ultrasound volume data (video data) saved as .mat files with voxel data type uint8 and respected position in other .mat file; what is the best way to import them into 3D slicer for processing? I convert video data (datavideo_ultrasound) to Dicom images, but I could not import position info to DICOM images. Could you please suggest me some solutions?

Thanks.

You can write the volume into a NRRD file using nrrdwrite.m and load that very easily into Slicer (and many other medical image computing software).

1 Like

It is working properly for one 2d image to load in Slicer. But for 3d image it is not working. I have one ultrasound video (.mat) file. where I generated 278 2d images using the for loop below. therefore I used ‘cat’ for generating 3d image. Then I used nrrdwrite to get nrrd file. but this 3d nrrd is showing nothing in slicer. I have positions of each 2d image, which is Commented in the code. It might work, if I can use position of 2d images for generating nrrd file. Is it possible to use the positions in nrrdwrite?

Thank you very much.

clc
for i=1:278
eval(sprintf(‘A%d = datavideo(:,:,1,i);’, i));
% eval(sprintf(‘position%d = new_psonda(:,:,i);’, i));
end

v1=cat(3,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10);
img.pixelData = v1;
nrrdwrite(‘v1’, img);

Is this a color image?

Please copy here the complete error message.

1 Like

No, it is grayscale image.

I find the error, I didn’t put .nrrd in the file name. Now it is working fine. Thank you very much.

nrrdwrite(‘v1.nrrd’, img);

1 Like