-
Notifications
You must be signed in to change notification settings - Fork 0
Registration Example Using Jupyter
Learn how we align an individual brain to a universal “average” brain (MNI space) so we can compare neuroimaging and neuropsychological data across people.
- Log in to ood.rc.ufl.edu.
- Open Clusters → HiPerGator Shell Access.
- Copy/paste the commands below one at a time (press Enter after each).
ln -s /blue/psy4930 ~/psy4930/blue/psy4930/share/data/neurotools/envs/psy4930/bin/python -m ipykernel install --user --name psy4930 --display-name "PSY4930 Class Kernel"This creates your folder (if needed) and copies the notebook you will run:
mkdir -p /blue/psy4930/$USER
cp /blue/psy4930/share/data/registration/class_image_registration_demo.ipynb /blue/psy4930/$USER/Sanity check (optional):
ls -lh /blue/psy4930/$USER/class_image_registration_demo.ipynb- In ood.rc.ufl.edu, go to Interactive Apps → JupyterLab.
- Use these resources:
- Cores: 2
- Memory: 8 GB
- Time: 3 hours
- Click Launch, then Connect to Jupyter.
- In JupyterLab’s left sidebar, open:
-
psy4930→ your GatorLink ID (your$USERfolder)
-
- Open class_image_registration_demo.ipynb.
-
CRITICAL: In the top-right kernel selector, choose:
- PSY4930 Class Kernel
If you do not select the class kernel, cells may fail due to missing Python packages.
What to say:
“We start with my cat, Melody. She moved between two photos. Run Cell 1.”
What students should notice:
- Red/green “ghosts” (halos) show raw misalignment error.
- The goal is to reduce the halos until the images overlap.
What to say:
“Run Cell 2. This is affine registration—think sliding/rotating a printed photo to match the other.”
What students should notice:
- Big movements are corrected (shift/rotate/scale) but this looks like the output of the first cell.
- It cannot fully correct local differences (e.g., parts moving independently).
What to say:
“Run Cell 3. Now we treat the image like clay. Diffeomorphic registration can warp local regions while keeping the overall mapping well-behaved.”
What students should notice:
- Local alignment improves (halos reduce further).
- The deformation grid/field shows where space was “pulled” and “pushed.”
What to say:
“Now we apply the same idea to a human brain—mapping an individual to the MNI152 template (the ‘universal average’). This can take ~60 seconds because it’s doing many computations.”
What students should notice (typical progression):
- Raw: strong red/green halos (misalignment).
- Linear: brain is in roughly the right location/size, but internal anatomy is still blurry/misaligned.
- Nonlinear (diffeomorphic): structures overlap much better; colors move toward yellow (red + green = yellow), indicating stronger agreement between images.
- Kernel not found: Re-run Phase 1B, then refresh JupyterLab.
-
Permission/path issues: Confirm you opened the notebook from
/blue/psy4930/$USER/and not from a read-only shared folder. - Out of memory/time: Relaunch JupyterLab with the requested resources (or higher if instructed).