PYDICOM-CODIFY(1)

πŸ“¦ version 3.0.2, in fedora 43, fedora 44

πŸ’– PYDICOM-CODIFY πŸ’–

okay bestie, listen. you know that thing where you have a DICOM file and you desperately need the pydicom (Python) code that would build that exact file from scratch? yeah. that's this. pydicom-codify reads a DICOM file and spits out the pydicom Python code that can create that file. it's giving reverse-engineering but make it cute. ✨


🌸 SYNOPSIS 🌸

pydicom codify [-h] [-e EXCLUDE_SIZE] [-p] [-s SAVE_AS] filespec [outfile]

πŸŽ€ OPTIONS πŸŽ€

✨ POSITIONAL ARGUMENTS ✨

  • filespec β€” the file spec, and she has range. the format is [pydicom::]filename[::element]. if you put the pydicom:: prefix in front, it grabs the pydicom test file with that name. if you hand her an element, she uses only that one data element inside the file. no cap. πŸ’…

Examples, copy these exactly bestie:

path/to/your_file.dcm
your_file.dcm::StudyDate
pydicom::rtplan.dcm::BeamSequence[0]
yourplan.dcm::BeamSequence[0].BeamNumber
  • outfile β€” the filename to write the Python code into. and if you don't give her one? the code just goes straight to stdout, right there in your terminal, main character behaviour. 🫢

πŸ’œ OPTIONAL ARGUMENTS πŸ’œ

  • -h, --help β€” show a help message and dip. the classic. πŸ™ˆ
  • -e EXCLUDE_SIZE, --exclude-size EXCLUDE_SIZE β€” excludes binary data bigger than whatever you specify. the default is 100 bytes, so anything chunkier than that gets ghosted. πŸ’€
  • -p, --include-private β€” includes private data elements. the default is to exclude them, so if you want them you gotta ask. 🌈
  • -s SAVE_AS, --save-as SAVE_AS β€” sets the filename used in ds.save_as(save_filename). if you don't pick one, she just uses your input name + _from_codify. iconic. πŸ‘‘

πŸ“ NOTES πŸ“

real talk, important stuff here:

  • Binary data (like, say, pixels πŸ–ΌοΈ) that's larger than --exclude-size (default 100 bytes) is not included. instead you get a dummy line with a syntax error. yes, a syntax error, on purpose, so you notice. 😭
  • Private data elements are not included by default. that's what -p is for.

πŸ‘€ SEE ALSO πŸ‘€


okay that's the whole vibe. go forth and codify, bestie. you're literally the moment. πŸ’…βœ¨

this has been PYDICOM-CODIFY(1), from the September 2024 era β€” stan a classic. πŸŽ€πŸ¦‹ bye pookie!! 🫢

πŸ“¦ where this page comes from