Code covered by the BSD License  

Highlights from
Read Medical Data 3D

image thumbnail

Read Medical Data 3D

by

 

10 Nov 2010 (Updated )

GUI to open most Medical file-formats: Dicom, V3D, ISI, NifTI, Analyze and other formats

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

isi_read_volume(info)
function [V] = isi_read_volume(info)
% function for reading volume of isi volume file
% isi_read_header(file-info)
%
% volume = isi_read_volume(file-header)
%
% examples:
% 1: info = isi_read_header()
%    V = isi_read_volume(info);
%    imshow(squeeze(V(:,:,round(end/2))),[]);
%
% 2: V = isi_read_volume('test.isi');

if(~isstruct(info)) info=isi_read_header(info); end

% Open isi file
fid=fopen(info.Filename,'rb');

  % Seek volume data start
  datasize=prod(info.Dimensions)*info.Bbp;
  fseek(fid,info.FileSize-datasize,'bof');

  % Read Volume data
  volsize(1:info.DimNum)=info.Dimensions;
  V = fread(fid,datasize,info.Type,0,'b');
fclose(fid);

% Reshape the volume data to the right dimensions
V = reshape(V,volsize);

Contact us