HOW TO OPEN IMAGE VOXEL MAN AS ATTACHED

1 Ansicht (letzte 30 Tage)
mohd akmal masud
mohd akmal masud am 21 Sep. 2022
Kommentiert: Image Analyst am 21 Nov. 2023
HELLO DEAR,
Anyone can help me open my image voxel man as link attached.
  2 Kommentare
Image Analyst
Image Analyst am 21 Sep. 2022
Do you have any idea of the format of the .dat file? Like how many rows, columns, or slices?
mohd akmal masud
mohd akmal masud am 21 Sep. 2022
There is 128x128x243 integer, 8 bit

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Udit06
Udit06 am 21 Nov. 2023
Bearbeitet: Udit06 am 21 Nov. 2023
I understand that you want to open the image stored in the "vox_man.dat" file which is of the size 128*128*243. You can use MATLAB's "fopen", "fread" and "fclose" functions to read image data stored in .dat file as shown below.
% Open the file for reading
fileID = fopen('vox_man.dat', 'r');
% Specify the image dimensions and data type
imageWidth = 128;
imageHeight = 128;
numChannels = 243;
dataType = 'uint8';
% Read the file contents into a vector
imageVector = fread(fileID, imageWidth * imageHeight * numChannels, dataType);
% Close the file
fclose(fileID);
%imageVector now contains the data stored in vox_man.dat file in a vector
%format, you can now reshape your data as per your requirement for further
%analysis.
For visualizing the image you may have to perform some statistical operations on your image data to reduce the number of channels to form an RGB or a grayscale image.
You can refer to the following MathWorks documentation to understand more about "fopen", "fread" and "fclose" functions respectively.
I hope this helps.
  1 Kommentar
Image Analyst
Image Analyst am 21 Nov. 2023
Here are the missing lines they forgot to add to the end of their script:
%imageVector now contains the data stored in vox_man.dat file in a vector
%format, you can now reshape your data as per your requirement for further analysis.
image3D = reshape(imageVector, [imageHeight, imageWidth, numChannels ]);
% Display options:
% Display the 3-D volumetric image slice by slice.
for k = 1 : numChannels
imshow(image3D(:, :, k), []); % Show slice k.
caption = sprintf('Displaying slice %d', k);
title(caption);
drawnow;
end
% Bring up in 3-D volume viewer.
volumeViewer(image3D)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by