neuroelf / neuroelf-matlab

NeuroElf (MATLAB)
Other
15 stars 14 forks source link

dealing with non-power-2 matrices in createfmr.m #3

Open igorkagan opened 4 years ago

igorkagan commented 4 years ago

The issue: createfmr does not work for non-power-2 matrix sizes, e.g. for the Siemens DICOM mosaic images with 7x7 arrangement:

Image columns: 490
Image rows: 490
Number of slices: 45
Mosaic rows: 70
Mosaic columns: 70

The following warning is issued: "Warning: Slice.STCData has an invalid size.", and .stc file is not created.

The suspected reason: lines 689 and the following:

% get things into a square matrix with a power-2
psdim = [64, 96, 128, 192, 256];
mxdim = max(DimX, DimY);
mndim = find(mxdim <= psdim);
if isempty(mndim)
    error( ...
        'neuroelf:DataTooLarge', ...
        'Data too large to fit into square matrix.' ...
    );
end
acdim = psdim(mndim(1));

Suggested solution - to allow non-power-2 matrix size, replacing the code above with the following (works fine for me): acdim = max(flags.xyres(1),flags.xyres(2))