cselenyi / solenabugs

Solena Bug Tracking
GNU Lesser General Public License v2.1
0 stars 0 forks source link

ecat PET file is cropped after realignEcat7 #25

Closed GinaGriffioen closed 3 years ago

GinaGriffioen commented 3 years ago

My realigned ecat file is cropped in 2 of 3 planes. There is no problem with the original PET file and when we run my pipeline on Max' computer, there is no problem. I have exactly the same pathways as Max.

Output in SPM is attached. 2020-12-11

The output file is in X:\kipet\atlas_images\human\vff\Gina2\KIH19002\jowi\raw\pet_ecat7 It is the second pet file, the first one is done by Max and is correct.

Here is the Worker output: Warning: Directory access failure: T:\downloads\m-files\solena\bin\solena_worker_202011181249_mcr\Users\Zsolt Cselnyi\Documents\MATLAB\Toolboxes\FFmpeg Toolbox Solena worker version: 2020-11-18 12:49:32 [MATLAB="8.4.0.150421 (R2014b)"; SPM="SPM12 (6225)"; ARCHITECTURE="win64"] Toolboxes: aal_201412151432, DEPICT_202008031130, kinfit_202011181249, zcode_202011181249, spm12_202011181249, sshfrommatlab_12_201602151334, vPET_201612151500, xml_io_tools_201412151432, freesurfer_201703281508, slicer_202009211234 Session UUID: 410cacb5-7bf9-47ec-abab-53d6b9c0d8ac Dec 11, 2020 3:41:56 PM java.util.prefs.WindowsPreferences WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Could not get solena_prefs:scratchpath. Temporary path is: C:\Users\gingri1\AppData\Local\Temp Starting interactive session: Frame-by-frame realignment of raw/pet_ecat7/191218_Wik-jowi2-2019.12.18.13.19.57_EM_MC.v (reference choice: BLOCK1, block-1 duration: 2 min, smoothing FWHM: 10 mm) FWHM for smoothing Gaussian will be: 10 mm. Frame-wise realignment directly to first 2 min block of frames. Using SPM realignment algorithm. Reading & accumulating & writing frame 1 Reading & accumulating & writing frame 2 Reading & accumulating & writing frame 3 Reading & accumulating & writing frame 4 Reading & accumulating & writing frame 5 Reading & accumulating & writing frame 6 Reading & accumulating & writing frame 7 Reading & accumulating & writing frame 8 Reading & accumulating & writing frame 9 Reading & accumulating & writing frame 10 Reading & accumulating & writing frame 11 Reading & accumulating frame 12 Reading & accumulating frame 13 Reading & accumulating frame 14 Obtaining realignment parameters for frames 12-14 in ECAT7 image


/ )( ( \/ )
_
\ )_
/ ) ( Statistical Parametric Mapping
(/() (/\/_) SPM12 - http://www.fil.ion.ucl.ac.uk/spm/

SPM12: v6225 15:44:51 - 11/12/2020

Initialising SPM : .......done

SPM present working directory: X:\kipet\atlas_images\human\vff\Gina2\KIH19002\jowi

SPM12: spm_realign (v6070) 15:45:05 - 11/12/2020

Completed : 15:45:16 - 11/12/2020 Reslicing frame 12: reading, reslicing, writing. Reslicing frame 13: reading, reslicing, writing. Reslicing frame 14: reading, reslicing, writing. Reading & accumulating frame 15 Reading & accumulating frame 16 Obtaining realignment parameters for frames 15-16 in ECAT7 image

SPM12: spm_realign (v6070) 15:46:04 - 11/12/2020

Completed : 15:46:14 - 11/12/2020 Reslicing frame 15: reading, reslicing, writing. Reslicing frame 16: reading, reslicing, writing. Reading & accumulating frame 17 Reading & accumulating frame 18 Obtaining realignment parameters for frames 17-18 in ECAT7 image

SPM12: spm_realign (v6070) 15:46:47 - 11/12/2020

Completed : 15:46:57 - 11/12/2020 Reslicing frame 17: reading, reslicing, writing. Reslicing frame 18: reading, reslicing, writing. Reading & accumulating frame 19 Obtaining realignment parameters for frames 19-19 in ECAT7 image

SPM12: spm_realign (v6070) 15:47:30 - 11/12/2020

Completed : 15:47:41 - 11/12/2020 Reslicing frame 19: reading, reslicing, writing. Reading & accumulating frame 20 Obtaining realignment parameters for frames 20-20 in ECAT7 image

SPM12: spm_realign (v6070) 15:47:58 - 11/12/2020

Completed : 15:48:08 - 11/12/2020 Reslicing frame 20: reading, reslicing, writing. Reading & accumulating frame 21 Obtaining realignment parameters for frames 21-21 in ECAT7 image

SPM12: spm_realign (v6070) 15:48:25 - 11/12/2020

Completed : 15:48:35 - 11/12/2020 Reslicing frame 21: reading, reslicing, writing. Reading & accumulating frame 22 Obtaining realignment parameters for frames 22-22 in ECAT7 image

SPM12: spm_realign (v6070) 15:48:53 - 11/12/2020

Completed : 15:49:03 - 11/12/2020 Reslicing frame 22: reading, reslicing, writing. Reading & accumulating frame 23 Obtaining realignment parameters for frames 23-23 in ECAT7 image

SPM12: spm_realign (v6070) 15:49:21 - 11/12/2020

Completed : 15:49:32 - 11/12/2020 Reslicing frame 23: reading, reslicing, writing. Reading & accumulating frame 24 Obtaining realignment parameters for frames 24-24 in ECAT7 image

SPM12: spm_realign (v6070) 15:49:48 - 11/12/2020

Completed : 15:49:58 - 11/12/2020 Reslicing frame 24: reading, reslicing, writing. Reading & accumulating frame 25 Obtaining realignment parameters for frames 25-25 in ECAT7 image

SPM12: spm_realign (v6070) 15:50:16 - 11/12/2020

Completed : 15:50:26 - 11/12/2020 Reslicing frame 25: reading, reslicing, writing. Reading & accumulating frame 26 Obtaining realignment parameters for frames 26-26 in ECAT7 image

SPM12: spm_realign (v6070) 15:50:44 - 11/12/2020

Completed : 15:50:54 - 11/12/2020 Reslicing frame 26: reading, reslicing, writing. Reading & accumulating frame 27 Obtaining realignment parameters for frames 27-27 in ECAT7 image

SPM12: spm_realign (v6070) 15:51:13 - 11/12/2020

Completed : 15:51:23 - 11/12/2020 Reslicing frame 27: reading, reslicing, writing. Reading & accumulating frame 28 Obtaining realignment parameters for frames 28-28 in ECAT7 image

SPM12: spm_realign (v6070) 15:51:40 - 11/12/2020

Completed : 15:51:49 - 11/12/2020 Reslicing frame 28: reading, reslicing, writing. Reading & accumulating frame 29 Obtaining realignment parameters for frames 29-29 in ECAT7 image

SPM12: spm_realign (v6070) 15:52:06 - 11/12/2020

Completed : 15:52:16 - 11/12/2020 Reslicing frame 29: reading, reslicing, writing. Reading & accumulating frame 30 Obtaining realignment parameters for frames 30-30 in ECAT7 image

SPM12: spm_realign (v6070) 15:52:34 - 11/12/2020

Completed : 15:52:43 - 11/12/2020 Reslicing frame 30: reading, reslicing, writing. Reading & accumulating frame 31 Obtaining realignment parameters for frames 31-31 in ECAT7 image

SPM12: spm_realign (v6070) 15:53:00 - 11/12/2020

Completed : 15:53:10 - 11/12/2020 Reslicing frame 31: reading, reslicing, writing. Reading & accumulating frame 32 Obtaining realignment parameters for frames 32-32 in ECAT7 image

SPM12: spm_realign (v6070) 15:53:27 - 11/12/2020

Completed : 15:53:36 - 11/12/2020 Reslicing frame 32: reading, reslicing, writing. Reading & accumulating frame 33 Obtaining realignment parameters for frames 33-33 in ECAT7 image

SPM12: spm_realign (v6070) 15:53:55 - 11/12/2020

Completed : 15:54:05 - 11/12/2020 Reslicing frame 33: reading, reslicing, writing. Reading & accumulating frame 34 Obtaining realignment parameters for frames 34-34 in ECAT7 image

SPM12: spm_realign (v6070) 15:54:25 - 11/12/2020

Completed : 15:54:35 - 11/12/2020 Reslicing frame 34: reading, reslicing, writing. Reading & accumulating frame 35 Obtaining realignment parameters for frames 35-35 in ECAT7 image

SPM12: spm_realign (v6070) 15:54:52 - 11/12/2020

Completed : 15:55:01 - 11/12/2020 Reslicing frame 35: reading, reslicing, writing. Reading & accumulating frame 36 Obtaining realignment parameters for frames 36-36 in ECAT7 image

SPM12: spm_realign (v6070) 15:55:19 - 11/12/2020

Completed : 15:55:29 - 11/12/2020 Reslicing frame 36: reading, reslicing, writing. Reading & accumulating frame 37 Obtaining realignment parameters for frames 37-37 in ECAT7 image

SPM12: spm_realign (v6070) 15:55:46 - 11/12/2020

Completed : 15:55:55 - 11/12/2020 Reslicing frame 37: reading, reslicing, writing. Reading & accumulating frame 38 Obtaining realignment parameters for frames 38-38 in ECAT7 image

SPM12: spm_realign (v6070) 15:56:12 - 11/12/2020

Completed : 15:56:22 - 11/12/2020 Realignment plot saved to: raw\pet_ecat7\191218_Wik-jowi2-2019.12.18.13.19.57_EM_MC_realign_plot.fig Realignment parameter results saved to: raw\pet_ecat7\191218_Wik-jowi2-2019.12.18.13.19.57_EM_MC_realign_results.mat Reslicing frame 38: reading, reslicing, writing. Performing FreeSurfer processing on processed/mr_ana/rolwi_MR_crop.nii Will use Docker image 'kipet/fsfsl:1.1' using FreeSurfer version 'stable-pub-v6.0.0' to process Starting docker container ... done. Mounting X:\kipet\atlas_images\human\vff\Gina2\KIH19002 to /home/user/data in container ... done. Will perform all stages of cortical reconstruction Will now run: recon-all -s KIH13005_olwi -all -parallel -openmp 1 Subject Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c Current Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c INFO: SUBJECTS_DIR is /opt/freesurfer/subjects Actual FREESURFER_HOME /opt/freesurfer -rwxr-xr-x 1 user user 984213 Dec 9 22:06 /opt/freesurfer/subjects/KIH13005_olwi/scripts/recon-all.log Linux fsfsl_de496e56 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux '/opt/freesurfer/bin/recon-all' -> '/opt/freesurfer/subjects/KIH13005_olwi/scripts/recon-all.local-copy'

--------------------------------------------

@# MotionCor Fri Dec 11 15:44:50 UTC 2020

Found 1 runs /opt/freesurfer/subjects/KIH13005_olwi/mri/orig/001.mgz Checking for (invalid) multi-frame inputs... WARNING: only one run found. This is OK, but motion correction cannot be performed on one run, so I'll copy the run to rawavg and continue.

cp /opt/freesurfer/subjects/KIH13005_olwi/mri/orig/001.mgz /opt/freesurfer/subjects/KIH13005_olwi/mri/rawavg.mgz

/home/user/data/olwi/freesurfer

mri_convert /opt/freesurfer/subjects/KIH13005_olwi/mri/rawavg.mgz /opt/freesurfer/subjects/KIH13005_olwi/mri/orig.mgz --conform

mri_convert.bin /opt/freesurfer/subjects/KIH13005_olwi/mri/rawavg.mgz /opt/freesurfer/subjects/KIH13005_olwi/mri/orig.mgz --conform $Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $ reading from /opt/freesurfer/subjects/KIH13005_olwi/mri/rawavg.mgz... TR=0.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (1, 0, 0) j_ras = (0, 0.968912, 0.247404) k_ras = (0, -0.247404, 0.968912) changing data type from float to uchar (noscale = 0)... MRIchangeType: Building histogram Reslicing using trilinear interpolation writing to /opt/freesurfer/subjects/KIH13005_olwi/mri/orig.mgz...

mri_add_xform_to_header -c /opt/freesurfer/subjects/KIH13005_olwi/mri/transforms/talairach.xfm /opt/freesurfer/subjects/KIH13005_olwi/mri/orig.mgz /opt/freesurfer/subjects/KIH13005_olwi/mri/orig.mgz

INFO: extension is mgz

--------------------------------------------

@# Talairach Fri Dec 11 15:45:05 UTC 2020

/home/user/data/olwi/freesurfer/mri

mri_nu_correct.mni --no-rescale --i orig.mgz --o orig_nu.mgz --n 1 --proto-iters 1000 --distance 50

/home/user/data/olwi/freesurfer/mri /opt/freesurfer/bin/mri_nu_correct.mni --no-rescale --i orig.mgz --o orig_nu.mgz --n 1 --proto-iters 1000 --distance 50 nIters 1 $Id: mri_nu_correct.mni,v 1.27 2016/02/26 16:19:49 mreuter Exp $

martingarde commented 3 years ago

Hi

I can add that I have been having the exact same problem since upgrading to windows 10 (enterprise). My log is an exact replica of Ginas (including the java error and failure to access the path mentioned above) so I wont post it here. However it might be of interest to know that this error might be related to windows 10 i some way.

kind regards

Martin

edit:

The produced realigned ecat7-files causes vinci to crash upon load. However it is possible to take a look at some of the header data. It seems the image dimensions are correct. By contrast the pixeldimensions are way of. Perhaps rather than a cropping issue this problem is related to when the header is written on the new ecat7 file.

I thought I'd mention this in case it could help with the bug hunt.

kind regards

Martin

cselenyi commented 3 years ago

Dear @GinaGriffioen and @martingarde, I have found the problem. During processing some parts of the ecat7 header data are supposed to be directly copied over from the input file to the output file. So these parts of the header information are supposed to be simply read into memory and dumped into the new file, without handling or altering them in any way. Among these parts of the header info are the dimensions of the 3D PET frame (which is 256 x 256 x 207). The issue arose from the fact that the file reading step tried to read these bytes as if they were 8-bit character codes, not as simply 8-bit, unsigned bytes. The problem is that this involves an element of code interpretation, which depending on operating system language (and locale) settings, makes that reading function interpret some numerical values as "invalid" character codes for which it replaces the code with character "27", i.e. "". Then the writing function will write out this value instead of the original, correct value. In particular, "207" is apparently an "invalid" 8-bit character code on your Windows 10 machines, but not on mine (with a US language setting) :-) So the number of planes was "cropped" in the header data to 27! I have fixed the code to not do this character code interpretation, really read each byte as a simple 8-bit unsigned number and so dump them into the output file unchanged. The fixed code is available in solena_worker_202101211208 (see #26).