We will be working with the DVARS metric.
The reference above defines DVARS as the “spatial root mean square”.
It’s a measure of the difference in the voxel values between two volumes.
this_vol is one 3D array representing a volume, and
prev_vol is another 3D array representing a volume. The DVARS difference between these two volumes is:
vol_diff = this_vol - prev_vol
dvar_val = np.sqrt(np.mean(vol_diff ** 2))
- Go to your breakout rooms as usual.
- We will send a pull request to the Github repository of your project’s upstream repository.
- A team member (maybe the driver) should merge the pull request on Github.
- The driver for your session should do the following steps, with the navigators instructing the driver what to do, and watching for (the inevitable) mistakes.
- The rest of the steps are for the driver.
- Start a terminal.
- Navigate to your Git working directory with something like
<team_name>is your team name.
- Fetch the new contents of the upstream repository with
git fetch upstream.
Start a new branch to do a PR to the upstream repository with:
git branch add-dvars upstream/main --no-track git checkout add-dvars
Install your new directory module
findoutlieusing the Python package manager Pip. Here we are using the
--editableflag to tell Pip to install the package in editable mode. In this mode, when you make changes to the package files, you see the changes in the installed package immediately, without having to do another install. You may or may not need the
--userflag. Try with
--user, and drop
--userif that fails.
python3 -m pip install --user --editable .
Now test that you can import the
findoutliemodule by running this command. The
-cflag tells Python to run the code that follows the
python3 -c 'import findoutlie'
This should give no error, because the previous step installed the
findoutliedirectory module to somewhere on Python’s search path. Tell us if any of the commands above did give an error.
Run the test command:
python3 -m pytest findoutlie/tests/test_dvars.py
If you get an error
No module named pytest, then run:
python3 -m pip install pytest
and try again.
Read the files:
and complete the
findoutlie/metrics.pyto make the tests pass.
Hint 1 — one of the ways to write the
dvarsfunction in the most efficient way, would use ideas from 4D to 2D reshaping page. You might also benefit from the
- When you have solved this, make a pull request to the upstream repository, and @ mention one of the instructors for a review.
You should now have a pull-request called: “MRG: Add detectors function and tests”. Merge this.
For instructions, see
You should also have a pull-request called: “Add SPM globals functions”. Merge this as well. It just adds the SPM globals function from your earlier exercise, in case you want to use it.
- Agree a provisional project analysis plan with your group. Don’t worry about the detail, it’s just a draft to get the discussion going, or even just to clarify your ideas about what the task is.
- Write it up as
analysis_plan.mdand make a pull request to your upstream repository.
When you think it is ready to merge, @ mention the instructors by adding a comment to the pull-request on the lines of:
@nipraxis-summer-2023/instructors - this plan is now ready for review.
We will review your analysis plan, discuss and then Approve it using the Github interface.
- Start work on the project.