heudiconv
heudiconv copied to clipboard
WiP Convergence on the use-cases analysis
Original/conventional Heudiconv operation
-
Overall a two stage procedure
-
prepare the conversion table for an accession using a heuristic (need
-c none
to run in this mode)- in the output directory creates
.heudiconv/<sub>[/<ses>]/info/
where it places:- copies the heuristic file
- copies the heudiconv.py
- creates
.auto
and.edit
conversion table
- in the output directory creates
- [optional] edit the NAME.edit.txt to tune up the conversion
-
apply the conversion table to the data
- (@yarikoptic thinks that) it is the same command line invocation as in prepare step. (@mgxd thinks that it is triggered by specifying a converter, e.g.
dcm2niix
) - Q: copies the heuristic file again? probably should be avoided
- (@yarikoptic thinks that) it is the same command line invocation as in prepare step. (@mgxd thinks that it is triggered by specifying a converter, e.g.
-
prepare the conversion table for an accession using a heuristic (need
-
If the conversion isn't proper (incomplete, erroneous),
-
edit the conversion table and re apply
- Q: how does it remove "erroneous" files (if at all?) -- probably doesn't
- overwrite already existing files (possibly requires already use of
--overwrite
file)
-
edit the heuristic and re apply
- In theory (not checked if implemented ATM) if a heuristic is changed then prepare should be redone, i.e. conversion table should be recreated (see https://github.com/nipy/heudiconv/issues/84#issuecomment-330048609)
-
edit the conversion table and re apply
@mgxd workflow for multiple subjects, study specific
- take a heuristic (e.g. convertall, @mgxd -- no
-f
it would defaultconvertall
) - run prepare (
-c None
) - looking at
.info
file, make a study heuristic - remove previous prepare result and now do the two stage procedure for the subject
- for any new subject just redo 1+3 in one command (like below for ReproIn use case)
- if anything screws up, just remove subject conversion and redo
ReproIn/Dartmouth DBIC approach/needs
heudiconv -f ~/heudiconv/heuristics/dbic_bids.py -c dcm2niix -o /inbox/BIDS --bids --datalad PATHTODICOMS
So it all worked collapsing both stages because of use of -c dcm2niix
which instruments the converter and thus causes the conversion right away:
-
if the conversion existed for that subject/session, it would be reused (instead of consulting the heuristic). caused some confusion see #84
-
that is why
--overwrite
was introduced to make it so by default no file gets modified -
PATHTODICOMS
typically contains a single accession (acquisition) for a subject in some session -
we run it once and it does both stages
Items
be able to provide --bids mode of operation by heuristic
--overwrite should not be needed in any of above usecases
If any file gets overridden (besides modifying participants.tsv, _scans.tsv, etc) -- that is a sign of trouble, and check should be done and --overwrite should be used with caution
conflated 2 stage procedure behavior whenever converter specified
As in #84 it is might be confusing whenever you run "full conversion" but it reuses previous conversion table.
@mgxd could you please add sample heudiconv invocations you use (e.g. either you use subj template etc)?
when working with a new dataset:
I generally use the subj template command
heudiconv -d /path/to/data/{subject}/*/*.dcm -f convertall.py -c none -o /output -s $subj
which generates the /output/.heudiconv/${subj}/info/dicominfo.tsv
file I parse and generate a specific heuristic for the dataset (if fixed parameters)
then, when applying
heudiconv -d /path/to/data/{subject}/*/*.dcm -f new_heuristic.py -c dcm2niix -o /output -s $subj -b --minmeta
#129 largely addressed it but I think we should make modes more explicit may be by changing cmdline API to first have a command