DICOMSORT(1)
π DICOMSORT π
okay bestie, buckle up β this is the dicomsort manual page, and it's genuinely one of the most useful little tools in the whole bidscoin universe. it's from the Generated Python Manual, and it's lowkey iconic. π
β¨ SYNOPSIS β¨
dicomsort [-h] [-i PREFIX] [-j PREFIX] [-f SCHEME] [-n SCHEME] [-p PATTERN] [--force] [-d] sourcefolder
like, that's the whole vibe. one positional argument, a handful of flags, and suddenly your DICOM situation is organized. periodt. π
πΈ DESCRIPTION πΈ
So here's the tea: dicomsort sorts and/or renames DICOM files into local subfolders, e.g. with 3-digit SeriesNumber-SeriesDescription folder names β which is basically the same listing as on the scanner console, so everything matches up and you're not sitting there squinting at chaos. π§ β¨
It supports flat DICOM as well as multi-subject/session DICOMDIR file structures. so whether your data is a single flat pile or a whole nested subject/session situation, it's handled. no cap. π¦
sourcefolder
The root folder containing the [sub/][ses/] dicomfiles or the DICOMDIR file.
that's your entry point, bestie β the root of everything, or the DICOMDIR itself. it's literally the only thing you have to give it. π
π OPTIONS π
-i PREFIX,--subprefix PREFIXβ give it a prefix string so it recursively sortssourcefolder/subjectsubfolders (think"sub-"or"S_"). like, tell it how your subjects are named and it'll go spelunking. π-j PREFIX,--sesprefix PREFIXβ same energy but for sessions: give it a prefix string to recursively sortsourcefolder/subject/sessionsubfolders (e.g."ses-"or"T_"). ποΈ-f SCHEME,--folderscheme SCHEMEβ the naming scheme for the sorted DICOM Series subfolders. it follows the Python string formatting syntax, with DICOM field names in curly bracers, plus an optional number of digits for numeric fields. and listen: sorting into subfolders is skipped when you give an empty folderscheme β but heads up, renaming the filenames can still totally happen anyway. π-n SCHEME,--namescheme SCHEMEβ an optional naming scheme you can provide to rename the DICOM files. also follows the Python string formatting syntax, DICOM field names in curly bracers, optional digit counts for numeric fields. for default names you'd use something like"{PatientName}_{SeriesNumber:03d}_{SeriesDescription}_{AcquisitionNumber:05d}_{InstanceNumber:05d}.dcm"or"{InstanceNumber:05d}_{SOPInstanceUID}.IMA". π-p PATTERN,--pattern PATTERNβ the regular expression pattern used inre.match(pattern, dicomfile)to select the DICOM files. iykyk. π―--forceβ sort the DICOM data even if the DICOM fields of the folder/name scheme are not in the data. bold. reckless. iconic. π₯-d,--dryrunβ only print thedicomsortcommands without actually doing anything. the "let me just see what would happen" button. truly the responsible main character move. π
π COMMENTS π
examples, bestie β copy these straight up:
dicomsort raw/sub-011/ses-mri01
dicomsort raw --subprefix sub- --sesprefix ses-
dicomsort myproject/raw/DICOMDIR --subprefix pat^ --sesprefix
dicomsort sub-011/ses-mri01/DICOMDIR -n '{AcquisitionNumber:05d}_{InstanceNumber:05d}.dcm'
see how chill that is? four little lines, four whole workflows. ate. π
π«Ά AUTHOR π«Ά
Marcel Zwiers <m.zwiers@donders.ru.nl>
give the person some flowers, they wrote your favorite sorter. π
and that's the whole page, bestie! go forth and sort responsibly. and maybe run it with -d first, because you know you should. πβ¨
okay final sign-off, the cute one: this whole thing is from bidscoin 4.6.2, dated 2025-11-06 β so if you're quoting it in the group chat, that's the version, that's the date, that's the era. ππ
π¦ where this page comes from
- fedora 43: bidscoin 4.6.2-1.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms