spatialtopology / spacetop-prep

code for transferring data and preprocessing
MIT License
0 stars 3 forks source link

[DUP] sub-0133_ses-04_task-social_acq-mb8_run-01 #57

Closed jungheejung closed 3 months ago

jungheejung commented 4 months ago

TODO

scannotes

PVC (task-social) run 01: full reboot - scanner did not boot.

jungheejung commented 4 months ago

@yarikoptic This is a scan where the DUP is longer (and expected size) compared to the BOLD data Based on the scannotes, the scanner rebooted. I wonder if this mismatch has to do with the scanner reboot?

Is there anything we can check to make sure the DUP is the correct file and that we need to salvage it? Maybe looking at the time acquired would help? or perhaps that's already the logic of Heudiconv. What do you think?

yarikoptic commented 4 months ago

interesting case which might warrant changes or at least a warning in heudiconv and possibly adjusting our SOPs (standard operating procedures) and/or PACS configuration for whenever scanner is restarted or otherwise session is interrupted but then started "like anew" with the same accession. TL;DR: as numbering of sequences was restarted upon restart new sequences with the same sequence number and name overwrote old ones. heudiconv used sequence number and name to decide on dups -- their sequence. It doesn't use Time of any kind, and thus it incorrectly assigned __dup to the NEWER sequences with smaller sequence number.

Time stamps for the dup and non-dup show that __dup is newer! ```shell ❯ for f in ./sub-0133/ses-04/func/sub-0133_ses-04_task-social_acq-mb8_run-01_bold*json; do echo $f; jq .AcquisitionTime $f; done ./sub-0133/ses-04/func/sub-0133_ses-04_task-social_acq-mb8_run-01_bold__dup-01.json "19:56:25.647500" ./sub-0133/ses-04/func/sub-0133_ses-04_task-social_acq-mb8_run-01_bold.json "19:13:43.712500" ```
sorting the DICOM folders for sequences with time (from DICOMs directly) shows that we pretty much overwrote 001-007 (scouts + fieldmaps) from before restarting the scanner ```shell [bids@rolando A004936] > for f in 0*/; do dcmdump +P 0008,0032 $f/0000011.dcm | sed -e 's,\[,,g' -e 's, *#.*,,g' | sort -n -k 4 | tr '\n' ' '; echo "$f"; done | sort -n -k 3 (0008,0032) TM 185009.875000] 007-func_run-01_task-fractional_acq-ap-mb8_SBRef/ (0008,0032) TM 185016.775000] 008-func_run-01_task-fractional_acq-ap-mb8/ (0008,0032) TM 190042.317500] 009-func_run-02_task-fractional_acq-ap-mb8_SBRef/ (0008,0032) TM 190049.217500] 010-func_run-02_task-fractional_acq-ap-mb8/ (0008,0032) TM 191336.812500] 011-func_run-01_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 191343.712500] 012-func_run-01_task-social_acq-ap-mb8/ (0008,0032) TM 195422.665000] 001-anat-scout_ses-04/ (0008,0032) TM 195422.665000] 002-anat-scout_ses-04_MPR_sag/ (0008,0032) TM 195422.665000] 003-anat-scout_ses-04_MPR_cor/ (0008,0032) TM 195422.665000] 004-anat-scout_ses-04_MPR_tra/ (0008,0032) TM 195526.747500] 005-fmap-epi_dir-ap_acq-mb8_run-01/ (0008,0032) TM 195550.345000] 006-fmap-epi_dir-pa_acq-mb8_run-01/ (0008,0032) TM 195618.747500] 007-func_run-01_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 195625.647500] 008-func_run-01_task-social_acq-ap-mb8/ (0008,0032) TM 200422.137500] 009-func_run-02_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 200429.037500] 010-func_run-02_task-social_acq-ap-mb8/ (0008,0032) TM 201210.677500] 011-func_run-03_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 201217.577500] 012-func_run-03_task-social_acq-ap-mb8/ (0008,0032) TM 201912.280000] 013-func_run-04_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 201919.180000] 014-func_run-04_task-social_acq-ap-mb8/ (0008,0032) TM 202703.235000] 015-func_run-05_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 202710.135000] 016-func_run-05_task-social_acq-ap-mb8/ (0008,0032) TM 203441.315000] 017-func_run-06_task-social_acq-ap-mb8_SBRef/ (0008,0032) TM 203448.215000] 018-func_run-06_task-social_acq-ap-mb8/ (0008,0032) TM 204203.955000] 019-anat-scout_ses-04/ (0008,0032) TM 204203.955000] 020-anat-scout_ses-04_MPR_sag/ (0008,0032) TM 204203.955000] 021-anat-scout_ses-04_MPR_cor/ (0008,0032) TM 204203.955000] 022-anat-scout_ses-04_MPR_tra/ (0008,0032) TM 204237.352500] 023-fmap-epi_dir-ap_acq-mb8_run-02/ (0008,0032) TM 204301.362500] 024-fmap-epi_dir-pa_acq-mb8_run-02/ (0008,0032) TM 204408.750000] 025-func_run-01_task-alignvideo_acq-ap-mb8_SBRef/ (0008,0032) TM 204415.650000] 026-func_run-01_task-alignvideo_acq-ap-mb8/ (0008,0032) TM 205415.875000] 027-func_run-02_task-alignvideo_acq-ap-mb8_SBRef/ (0008,0032) TM 205422.775000] 028-func_run-02_task-alignvideo_acq-ap-mb8/ ```
jungheejung commented 4 months ago

@yarikoptic and I plan to use the rename_file script to resolve these swapped dups.

yarikoptic commented 4 months ago

should be "compatible" with datalad run, so do via that -- it would help to record explicitly what was renamed from what

jungheejung commented 3 months ago

c0940dc881edf6c564dc40d0bbd0238a87aaa188 ./code/spacetop-prep/spacetop_prep/datalad/remove_dups_anatfmap.sh