DICOMSORT(1)

πŸ“¦
version 4.6.2 Β· 2 versions
, in fedora 43

πŸ’– 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 sorts sourcefolder/subject subfolders (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 sort sourcefolder/subject/session subfolders (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 in re.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 the dicomsort commands 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