Python File Index

Porgams are located in ~reeves/v4/py/

FileDescription (module docstring)
attenseg.py
(no module docstring found)
attlabel.py
Combined pipeline (no intermediate file):

- Former attenscale.py:
  * Load float attention NIfTI
  * Optional clip to [0,1]
  * Scale to uint8 [0..255]
  * Gaussian filter

- Former vnlabel.py:
  * Load DICOM series -> HU
  * Window/level -> uint8
  * Convert to RGB
  * Overlay attention (treated like labels) with matplotlib colormap
  * Save RGB NIfTI with intent NIFTI_INTENT_RGB_VECTOR

Dependencies:
  pip install pydicom nibabel matplotlib scipy numpy
dcmedit.py
dcmedit.py

Batch-edit selected DICOM header fields for all DICOM files in a directory.

Edits (if provided via command-line options):
- Patient's Name        (0010,0010)  -> --patient-name
- Patient ID            (0010,0020)  -> --patient-id
- Study Date            (0008,0020)  -> --study-date   (YYYYMMDD recommended)
- Acquisition Number    (0020,0012)  -> --acq-number   (integer recommended)

For each readable DICOM file in input_dir:
- read dataset
- update selected tags
- write to output_dir with same filename
mapbbox.py
Create a uint8 NIfTI mask from CSV-defined 3D bounding boxes, sized to a DICOM CT series.

Assumptions:
- Input is a directory of single-frame CT slices
- CSV x,y,z are 0-based voxel indices
- Coordinate convention: x = column index, y = row index, z = slice index
- Each row defines a 3D box by center (x,y,z) and full size (xs,ys,zs)
- Output can be:
    * filled boxes (default)
    * box outlines only (optional) for BOTH NIfTI mask and PNG previews
nifti-intent.py
Check whether a NIfTI file has NIFTI_INTENT_RGB_VECTOR set.
print_nifti_header.py
Print the header of a NIfTI image.
rotate_axial_180.py
Rotate a NIfTI image by 180 degrees in the axial plane.

Supports:
- 3D scalar volumes:        (X, Y, Z)
- 3D RGB vector volumes:    (X, Y, Z, 3) uint8, typically with NIFTI_INTENT_RGB_VECTOR

By default, updates the affine so world coordinates are preserved.
vnlabel.py
3D pipeline:
1) Read a DICOM *series* (folder) into a 3D volume and convert to HU (if available),
   then window to uint8 using WW=1500 and WL=-650.
2) Read a uint8 NIfTI 3D label image (0=background, >0 labels).
3) Convert windowed uint8 volume to RGB uint8 volume (X,Y,Z,3).
4) Colorize labels with a matplotlib colormap (low labels darker, high labels brighter) and overlay.
5) Write RGB NIfTI with intent = NIFTI_INTENT_RGB_VECTOR.

Dependencies:
  pip install pydicom nibabel matplotlib