Skip to content

Commit ff8091e

Browse files
committed
putting 0.13.3 up to date
2 parents dfeea0c + f52cddb commit ff8091e

File tree

10 files changed

+137
-28
lines changed

10 files changed

+137
-28
lines changed

commands/formats/niak_fileparts.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
% behaves differently for .gz files (see OUTPUTS).
4444
%
4545
% Copyright (c) Pierre Bellec, Centre de recherche de l'institut de
46-
% geriatrie de Montreal, 2010
46+
% geriatrie de Montreal, 2010-2015
4747
% Maintainer : [email protected]
4848
% See licensing information in the code.
4949
% Keywords :

commands/formats/niak_hdr_mat2minc.m

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
function [direction_cosine,step,start] = niak_hdr_mat2minc(mat)
2-
3-
%
4-
% _________________________________________________________________________
5-
% SUMMARY NIAK_HDR_MAT3MINC
6-
%
72
% Convert a "voxel-to-world" coordinates affine transformation from the standard
83
% 4*4 matrix array (y=M*x+T) to the cosines/start/step representation used
94
% in minc headers.
@@ -43,9 +38,11 @@
4338
% SEE ALSO:
4439
% NIAK_READ_HDR_MINC, NIAK_WRITE_MINC, NIAK_HDR_MINC2MAT
4540
%
46-
% Copyright (c) Pierre Bellec, McConnel Brain Imaging Center, Montreal
47-
% Neurological Institute, McGill University, Montreal, Canada, 2008.
48-
% Maintainer : [email protected]
41+
% Copyright (c) Pierre Bellec,
42+
% Montreal Neurological Institute, 2008-2010
43+
% Departement d'informatique et de recherche operationnelle
44+
% Centre de recherche de l'institut de Geriatrie de Montreal
45+
% Universite de Montreal, 2011-2015
4946
% See licensing information in the code.
5047
% Keywords : medical imaging, I/O, affine transformation, minc
5148

commands/misc/niak_gb_vars.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
gb_niak_version = '0.13.3';
144144

145145
%% Target for tests
146-
gb_niak_target_test = '0.13.2';
146+
gb_niak_target_test = '0.13.3';
147147

148148
%% In which path is NIAK ?
149149
str_read_vol = which('niak_read_vol');

commands/read_write/niak_read_hdr_nifti.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@
341341
end
342342

343343
%% hdr.info.dimension_order
344-
hdr.info.dimension_order = '';
344+
if hdr.info.dimensions(end)>1
345+
hdr.info.dimension_order = 'xyzt';
346+
else
347+
hdr.info.dimension_order = 'xyz';
348+
end
345349

346350
%% hdr.info.history
347351
hdr.info.history = hdr.details.descrip;

commands/read_write/niak_read_nifti.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@
4545
% toolbox by Jimmy Shen ([email protected]) who agreed for
4646
% redistribution under the MIT license.
4747
%
48-
% Copyright (c) Pierre Bellec, Montreal Neurological Institute, 2008.
49-
% Maintainer : [email protected]
48+
% Note that the precision of the data is forced to single (32 bits).
49+
%
50+
% Copyright (c) Pierre Bellec,
51+
% Montreal Neurological Institute, 2008-2010
52+
% Departement d'informatique et de recherche operationnelle
53+
% Centre de recherche de l'institut de Geriatrie de Montreal
54+
% Universite de Montreal, 2011-2015
5055
% See licensing information in the code.
5156
% Keywords : medical imaging, I/O, reader, nifti
5257

@@ -165,4 +170,5 @@
165170
hdr.details.scl_inter = 0;
166171
end
167172
vol = single(vol);
173+
hdr.info.precision = 'float';
168174
end

commands/read_write/niak_read_vol.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@
122122
% consistent way for all data formats.
123123
%
124124
% Copyright (c) Pierre Bellec, Montreal Neurological Institute, 2008.
125-
% Centre de recherche de l'institut de Gériatrie de Montréal,
126-
% Département d'informatique et de recherche opérationnelle,
127-
% Université de Montréal, 2010-2011.
125+
% Centre de recherche de l'institut de Griatrie de Montral,
126+
% Dpartement d'informatique et de recherche oprationnelle,
127+
% Universit de Montral, 2010-2011.
128128
% Maintainer : [email protected]
129129
% See licensing information in the code.
130130
% Keywords : medical imaging, I/O, reader, minc

commands/read_write/niak_write_minc.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
%% Setting up default values for the 'info' part of the header
125125
hdr.info.dimensions = size(vol);
126126
gb_name_structure = 'hdr.info';
127-
gb_list_fields = {'precision','voxel_size','mat','dimension_order','tr','history','file_parent','dimensions'};
128-
gb_list_defaults = {'float',[1 1 1],[],'xyzt',1,'','',[]};
127+
gb_list_fields = {'machine' , 'precision' , 'voxel_size' , 'mat' , 'dimension_order' , 'tr' , 'history', 'file_parent' , 'dimensions' };
128+
gb_list_defaults = {'' , 'float' , [1 1 1] , [] , 'xyzt' , 1 , '' , '' , [] };
129129
niak_set_defaults
130130

131131
if isempty(hdr.info.mat)

commands/read_write/niak_write_nifti.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
hdr.details.datatype = 8;
141141
hdr.details.bitpix = int16(32);
142142
vol = int32(vol);
143-
case 'float32'
143+
case {'float32','float'}
144144
hdr.details.datatype = 16;
145145
hdr.details.bitpix = int16(32);
146146
vol = single(vol);

commands/visualization/niak_montage.m

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
function [] = niak_montage(vol,opt)
2-
%
3-
% _________________________________________________________________________
4-
% SUMMARY NIAK_MONTAGE
5-
%
62
% Visualization of a 3D volume in a montage style (all slices in one image)
73
%
8-
% SYNTAX:
9-
% [] = NIAK_MONTAGE(VOL,OPT)
4+
% SYNTAX: [] = NIAK_MONTAGE(VOL,OPT)
105
%
116
% _________________________________________________________________________
127
% INPUTS:
@@ -80,9 +75,13 @@
8075
% If both the number of rows ans the number of columns are specified, the
8176
% number of slices are adapted to match the montage.
8277
%
83-
% Copyright (c) Pierre Bellec, McConnell Brain Imaging Center,
84-
% Montreal Neurological Institute, McGill University, 2008.
85-
% Maintainer : [email protected]
78+
% Copyright (c) Pierre Bellec,
79+
% Montreal Neurological Institute, 2008-2010
80+
% Departement d'informatique et de recherche operationnelle
81+
% Centre de recherche de l'institut de Geriatrie de Montreal
82+
% Universit de Montral, 2011-2015
83+
% Maintainer : [email protected]
84+
8685
% See licensing information in the code.
8786
% Keywords : medical imaging, montage, visualization
8887

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
function [status,msg] = niak_register(file1,file2,varargin)
2+
% Visualize one or two registered volume using the "register" MINC tool
3+
%
4+
% SYNTAX: [STATUS,MSG] = NIAK_REGISTER(FILE1,FILE2,OPT)
5+
%
6+
% FILE1 (string) the name of a minc or nifti file.
7+
% FILE2 (string) the name of a minc or nifti file.
8+
% OPT (string) any argument to send to register.
9+
% STATUS (integer) 0 if call to register was successful, non-zero otherwise.
10+
% MSG (string) the feedback from the call to register.
11+
%
12+
% File names can be either relative or absolute, and .gz compression is supported.
13+
%
14+
% It is possible to use niak_register like the command line tool, e.g.
15+
% niak_register file1.mnc file2.mnc
16+
% This also works for options, that need to be specified at the end.
17+
%
18+
% Copyright (c) Pierre Bellec,
19+
% Montreal Neurological Institute, 2008-2010
20+
% Departement d'informatique et de recherche operationnelle
21+
% Centre de recherche de l'institut de Geriatrie de Montreal
22+
% Universite de Montreal, 2011-2015
23+
% See licensing information in the code.
24+
% Keywords : MINC, register, visualization
25+
26+
% Permission is hereby granted, free of charge, to any person obtaining a copy
27+
% of this software and associated documentation files (the "Software"), to deal
28+
% in the Software without restriction, including without limitation the rights
29+
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30+
% copies of the Software, and to permit persons to whom the Software is
31+
% furnished to do so, subject to the following conditions:
32+
%
33+
% The above copyright notice and this permission notice shall be included in
34+
% all copies or substantial portions of the Software.
35+
%
36+
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37+
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38+
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39+
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40+
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41+
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42+
% THE SOFTWARE.
43+
44+
%% Syntax
45+
if nargin < 2
46+
error('Syntax: niak_register file1 file2. See ''help niak_register''')
47+
end
48+
49+
if nargin < 3
50+
opt = '';
51+
else
52+
opt_str = '';
53+
for vv = 1:length(varargin)
54+
opt_str = [opt_str ' ' varargin{vv}];
55+
end
56+
opt = opt_str;
57+
end
58+
59+
%% Convert files from nii to mnc, if necessary
60+
[path1,fname1,ext1,zip1,type1] = niak_fileparts(file1);
61+
if ismember(type1,{'.nii','.img'})
62+
file1_mnc = psom_file_tmp([fname1,'.mnc']);
63+
[hdr,vol] = niak_read_vol(file1);
64+
hdr_mnc = rmfield(hdr,'details');
65+
hdr_mnc.type = 'minc2';
66+
hdr_mnc.file_name = file1_mnc;
67+
niak_write_vol(hdr_mnc,vol);
68+
flag_tmp1 = true;
69+
elseif strcmp(type1,'.mnc')
70+
file1_mnc = file1;
71+
flag_tmp1 = false;
72+
else
73+
error('FILE1 needs to be either a minc or nifti file (extensions .nii(.gz), .img, .mnc(.gz))')
74+
end
75+
76+
%% Convert files from nii to mnc, if necessary
77+
[path2,fname2,ext2,zip2,type2] = niak_fileparts(file2);
78+
if ismember(type2,{'.nii','.img'})
79+
file2_mnc = psom_file_tmp([fname2,'.mnc']);
80+
[hdr,vol] = niak_read_vol(file2);
81+
hdr_mnc = rmfield(hdr,'details');
82+
hdr_mnc.type = 'minc2';
83+
hdr_mnc.file_name = file2_mnc;
84+
niak_write_vol(hdr_mnc,vol);
85+
flag_tmp2 = true;
86+
elseif strcmp(type2,'.mnc')
87+
file2_mnc = file2;
88+
flag_tmp2 = false;
89+
else
90+
error('FILE2 needs to be either a minc or nifti file (extensions .nii(.gz), .img, .mnc(.gz))')
91+
end
92+
93+
%% Finally call register
94+
instr_register = ['register ' opt ' ' file1_mnc ' ' file2_mnc];
95+
[status,msg] = system(instr_register);
96+
97+
%% Clean up
98+
if flag_tmp1
99+
psom_clean(file1_mnc,struct('flag_verbose',false));
100+
end
101+
if flag_tmp2
102+
psom_clean(file2_mnc,struct('flag_verbose',false));
103+
end

0 commit comments

Comments
 (0)