- Many of the
.py
files use helper functions defined inutils.py
- Most of these helper functions just print out useful information, or they help in retrieving common files across the different patient directories (e.g.
readANTS
andget_common_files
)
resize.m
- This is a Matlab script that resizes the MRI mask to match the size of the CT mask.
- The
dim
(number of voxels in the xyz directions) and thepixdim
(voxel spacing; size of voxel in the xyz directions), are matched to what values they have in the CT mask's header file. This is done as a consequence of theimresize3
function in Matlab. - After resizing, transfer the local
imgs/
directory into the server - One can check the header file in ITK-SNAP through
Tools > Image Information
, to confirm that the resize changes were applied.
register.sh
- Runs all these scripts:
cleanup.sh
- This is an optional script that cleans up any files generated from previous registration attempts.
- Used primarily when testing registration.
reorient.py
- At this stage, the MRI masks closely match the size of the CT masks, but they just need to be reoriented (and translated, and deformed using the subsequent scripts).
- This script will modify the affine matrices of the CT masks to have RAS axis codes, and the affine matrices of the MRI masks to have SRA axis codes.
register.py
- This is the first phase of registration. The resized and reoriented MR masks are aligned to match the CT masks by translation.
- The
type_of_transform
parameter was set toSimilarity
. - In the second and final phase of registration, the resized, reoriented and translated MR masks undergoes a deformation so that the boundary of the MR mask closely matches the boundary in the CT mask.
- The
type_of_transform
parameter in the second stage was set toSynAggro
.
unpack.py
- This script loads the warped MRI images from the serialized output of the similarity registration in the previous step.
- The warped MRI images are saved in the patient directories (e.g. PIm0028) that they originally came from.
unzip.sh
- This script just unzips the warped MRI images generated in the registration process.
- The file extension of the warped MRI images changes from
.nii.gz
to.nii
warp_vent.py
- Applies the forward transformations from the registration (of the MRI mask onto the CT mask) to the ventilation image as well
First registration phase finished on 11/5/2024
git init
makes this a master branch by defaultgite remote add origin <repo>
git checkout main
git status
to ensure that the current branch is maingit pull origin main --allow-unrelated-histories
to pull stuff in main that is not in master because the default branch is mastergit push origin main
this puts all the stuff in master into maingit push origin --delete master
deletes master; now we just have main`
- ???
- Figure out how VDP is calculated in duke pipeline
mask.shape
vent_mask_volm.shape
masked = apply_mask(mask=mask, data=vent_mask_volm)
nib.save(img=nib.nifti1.Nifti1Image(masked, vent_mask_imag.affine), filename="___.nii")