-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcxloadfile.m
40 lines (38 loc) · 1.17 KB
/
mcxloadfile.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function [data, header]=mcxloadfile(fname,varargin)
%
% [data, header]=mcxloadfile(fname)
% or
% [data, header]=mcxplotvol(fname,dim,format)
%
% author: Qianqian Fang (q.fang <at> neu.edu)
%
% input:
% fname: the file name to the output .mc2/.nii/binary volume file
% dim: an array to specify the output data dimension
% normally, dim=[nx,ny,nz,nt]
% format:a string to indicate the format used to save
% the .mc2 file; if omitted, it is set to 'float'
%
% output:
% data: the 3-D or 4-D data being loaded
% header: a structure recording the metadata of the file
%
% this file is part of Monte Carlo eXtreme (MCX)
% License: GPLv3, see http://mcx.sf.net for details
%
[pathstr,name,ext] = fileparts(fname);
if(strcmpi(ext,'.nii'))
nii=mcxloadnii(fname,varargin{:});
data=nii.img;
header=nii.hdr;
elseif(strcmpi(ext,'.mc2'))
data=loadmc2(fname,varargin{:});
data=log10(data);
header.dim=varargin{1};
header.format=class(data);
header.scale='log10';
elseif(strcmpi(ext,'.mch'))
[data, header]=loadmch(fname),varargin{:};
else
data=loadmc2(fname,varargin{:});
end