Skip to content
Snippets Groups Projects

BF: make fslcomplex preserve image orientation

Merged Paul McCarthy requested to merge bf/fslcomplex-orient into master
+ 14
15
@@ -576,11 +576,16 @@ int read_complexvolume(volume<float>& realvols, volume<float>& imagvols,
extensions.clear();
}
for ( size_t voxel=0;voxel<volsize && !isComplex;voxel++) //Only copy real buffer for non-complex
rbuffer[voxel]=((float*)buffer)[voxel];
for ( size_t voxel=0;voxel<volsize && isComplex;voxel++) {
rbuffer[voxel]=((float *)buffer)[2*voxel];
ibuffer[voxel]=((float *)buffer)[2*voxel+1];
//Only copy real buffer for non-complex
if (!isComplex) {
for ( size_t voxel=0;voxel<volsize && !isComplex;voxel++)
rbuffer[voxel]=((float*)buffer)[voxel];
}
else {
for ( size_t voxel=0;voxel<volsize && isComplex;voxel++) {
rbuffer[voxel]=((float *)buffer)[2*voxel];
ibuffer[voxel]=((float *)buffer)[2*voxel+1];
}
}
realvols.reinitialize(sx,sy,sz,st,rbuffer,true);
imagvols.reinitialize(sx,sy,sz,st,ibuffer,true);
@@ -588,16 +593,10 @@ int read_complexvolume(volume<float>& realvols, volume<float>& imagvols,
realvols.setdims(niihdr.pixdim[1],niihdr.pixdim[2],niihdr.pixdim[3],niihdr.pixdim[4]);
imagvols.setdims(niihdr.pixdim[1],niihdr.pixdim[2],niihdr.pixdim[3],niihdr.pixdim[4]);
// swap to Radiological when necessary
if ( NiftiGetLeftRightOrder(niihdr) != FSL_RADIOLOGICAL ) {
realvols.RadiologicalFile = false;
realvols.makeradiological();
imagvols.RadiologicalFile = false;
imagvols.makeradiological();
} else {
realvols.RadiologicalFile = true;
imagvols.RadiologicalFile = true;
}
set_volume_properties(niihdr,realvols);
set_volume_properties(niihdr,imagvols);
delete [] buffer;
return 0;
}
Loading