From 74e6cc3d7c288aa62292f550fd3e80148faac126 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Wed, 13 Nov 2024 16:27:00 -0500 Subject: [PATCH] Update qForm with crop (https://github.com/rordenlab/dcm2niix/issues/889) --- console/nii_dicom.h | 2 +- console/nii_dicom_batch.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/console/nii_dicom.h b/console/nii_dicom.h index 664e4a1e..60e5fd84 100644 --- a/console/nii_dicom.h +++ b/console/nii_dicom.h @@ -50,7 +50,7 @@ extern "C" { #define kCPUsuf " " // unknown CPU #endif -#define kDCMdate "v1.0.20241106" +#define kDCMdate "v1.0.20241111" #define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf kCPUsuf static const int kMaxEPI3D = 1024; // maximum number of EPI images in Siemens Mosaic diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index edc36f57..ed9a4e2d 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -6502,6 +6502,16 @@ int nii_saveCrop(char *niiFilename, struct nifti_1_header hdr, unsigned char *im hdrX.srow_x[3] += hdr.srow_x[2] * ventralCrop; hdrX.srow_y[3] += hdr.srow_y[2] * ventralCrop; hdrX.srow_z[3] += hdr.srow_z[2] * ventralCrop; + //issue889 - also change origin for qform + //mork + mat44 Q44; + LOAD_MAT44(Q44, + hdrX.srow_x[0], hdrX.srow_x[1], hdrX.srow_x[2], hdrX.srow_x[3], + hdrX.srow_y[0], hdrX.srow_y[1], hdrX.srow_y[2], hdrX.srow_y[3], + hdrX.srow_z[0], hdrX.srow_z[1], hdrX.srow_z[2], hdrX.srow_z[3]); + float dumdx, dumdy, dumdz; + nifti_mat44_to_quatern(Q44, &hdrX.quatern_b, &hdrX.quatern_c, &hdrX.quatern_d, &hdrX.qoffset_x, &hdrX.qoffset_y, &hdrX.qoffset_z, &dumdx, &dumdy, &dumdz, &hdrX.pixdim[0]); + // convert data unsigned char *imX; imX = (unsigned char *)malloc((nVox2D * slices) * 2); // sizeof( short) );