opening a .rec file

28 visualizaciones (últimos 30 días)
richard
richard el 27 de Ag. de 2014
Comentada: Image Analyst el 28 de Ag. de 2014
I have a .rec file which is supposed to be a reconstructed SPECT image of a point source. I am trying to open it up in matlab.
I have usually used the following generic way of opening image data files in matlab:
fid = fopen('filename.ext','r');
A = fread(fid,sizeA,precision);
imagesc(A)
colormap('gray')
axis image off
but this block of code does not open my .rec file in this case. It simply returns a blank gray screen with no image. I was told something about specifying the file format, but I'm not sure how to do this.
  5 comentarios
richard
richard el 28 de Ag. de 2014
The A matrix is zero so as a result there are x's only at zero...
Image Analyst
Image Analyst el 28 de Ag. de 2014
Attach your image and code to read it so we can (perhaps) try to fix it.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 27 de Ag. de 2014
Richard,
No, precision would be something like '*uint8'. What you called precision is actually "sizeA" and would be sizeA = [45, 45]. So try
sizeA = [45, 45];
precision = '*uint8';
A = fread(fid,sizeA,precision);
imshow(A, [])
colormap('gray');
axis on;
  5 comentarios
richard
richard el 27 de Ag. de 2014
Yea I tried changing the machine format to all those listed, the matrix I get for A is still all zeroes... do you think that this attachment would get me where I need to be? I got the M-file from this url: http://www.mathworks.com/matlabcentral/fileexchange/29344-read-medical-data-3d/content/ReadData3D.m
Image Analyst
Image Analyst el 27 de Ag. de 2014
It may. Looks like you need the fig file also since it's a GUIDE file. Try reading in A as bytes, or just opening it in notepad. Is it all zeros if you use either of those? If so, then the file actually is all zeros for some reason.

Iniciar sesión para comentar.

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by