Skip to content

Commit fa96edc

Browse files
authored
Merge pull request #5 from HealthBioscienceIDEAS/4-excercise4
4 - Exercise 4 with itk-snap
2 parents 428e1ce + c29b886 commit fa96edc

33 files changed

Lines changed: 34547 additions & 14 deletions

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## vim temp files
2+
*.swp
3+
4+
## .nii.gz
5+
*.nii.gz
6+
17
# sandpaper files
28
episodes/*html
39
site/*
@@ -51,3 +57,4 @@ po/*~
5157

5258
# renv sandbox needed for renv version 0.16.0
5359
renv/sandbox # OPTIONAL
60+

CONTRIBUTING.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,54 @@ three.
7474

7575
### Using GitHub
7676

77-
If you choose to contribute via GitHub, you may want to look at [How to
78-
Contribute to an Open Source Project on GitHub][how-contribute]. In brief, we
79-
use [GitHub flow][github-flow] to manage changes:
80-
81-
1. Create a new branch in your desktop copy of this repository for each
82-
significant change.
83-
2. Commit the change in that branch.
84-
3. Push that branch to your fork of this repository on GitHub.
85-
4. Submit a pull request from that branch to the [upstream repository][repo].
86-
5. If you receive feedback, make changes on your desktop and push to your
87-
branch on GitHub: the pull request will update automatically.
77+
#### Committing and pushing changes
78+
1. Clone this repo
79+
```
80+
git clone git@github.com:UCL/real-time-ai-for-surgery.git
81+
```
82+
2. Create new branch using issue number
83+
```
84+
git checkout -b ISSUENUMBER-branch-name
85+
```
86+
3. Commit changes and push to your branch
87+
```
88+
git add .
89+
git commit -m 'short message (#ISSUENUMBER)'
90+
git push origin ISSUENUMBER-branch-name
91+
```
92+
4. Submit a Pull Request against the `main` branch.
93+
94+
#### Pull Request (PR) and merge to `main` branch
95+
1. Select branch that contain your commits.
96+
2. Click `Compare and pull request` and create PR for the associated branch.
97+
3. Type a title and description of your PR and create PR
98+
4. Please keep your PR in sync with the base branch.
99+
```
100+
git checkout main
101+
git pull origin main
102+
git checkout FEATURE_BRANCH
103+
git rebase main
104+
git push --force origin FEATURE_BRANCH
105+
```
106+
4.1 In case you are in a different `MY_FEATURE_BRANCH` branch, follow:
107+
```
108+
git checkout FEATURE_BRANCH
109+
git pull origin FEATURE_BRANCH
110+
git checkout MY_FEATURE_BRANCH
111+
git rebase FEATURE_BRANCH
112+
git push --force origin MY_FEATURE_BRANCH
113+
```
114+
5. Run `pre-commit` to tidy up code and documentation (see next section).
115+
6. Request a PR review.
116+
See [collaborating-with-pull-requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) for further details.
117+
7. Once your PRs has been approved, procced to merge it to main. See [Merging a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request)
118+
8. Remove your merged branch from your repo and in the list of https://github.com/UCL/real-time-ai-for-surgery/branches
119+
```
120+
#Local git clear
121+
git branch --merged | grep -v '\*\|master\|main\|develop' | xargs -n 1 git branch -d
122+
#Remote git clear
123+
git branch -r --merged | grep -v '\*\|master\|main\|develop' | sed 's/origin\///' | xargs -n 1 git push --delete origin
124+
```
88125

89126
NB: The published copy of the lesson is usually in the `main` branch.
90127

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
## Medical-Image-Registration-Short-Course
22

3-
This is the lesson repository for Medical-Image-Registration-Short-Course
3+
This is the lesson repository for [Medical-Image-Registration-Short-Course](https://healthbioscienceideas.github.io/Medical-Image-Registration-Short-Course)
4+
5+
## Setting up and preview sandpaper
6+
See [details](_setting_up) to setup sandpaper and its dependencies. Otherwise you are ready to preview your work:
7+
```
8+
R
9+
sandpaper::build_lesson()
10+
```
11+

_dependencies/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dependencies
2+
* Using conda
3+
```
4+
conda create -n "mirVE" python=3.11 pip -c conda-forge
5+
conda activate mirVE
6+
cd /_dependencies
7+
pip install -r requirements.txt
8+
conda list -n mirVE #to check installed packages
9+
conda remove -n mirVE --all #in case you want to remove it
10+
```
11+
* Using python virtual environment
12+
```
13+
# Installing dependencies in Ubuntu 22.04
14+
sudo apt-get install -y python3-pip
15+
sudo apt-get install -y python3-venv
16+
# Create path for venv
17+
cd $HOME
18+
mkdir mirVE
19+
cd mirVE
20+
# Create virtual environment
21+
python3 -m venv mirVE
22+
source mirVE/bin/activate
23+
cd /_dependencies
24+
python3 -m pip install -r requirements.txt
25+
```

_dependencies/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
numpy
2+
matplotlib
3+
dicom2nifti
4+
nibabel

_setting_up/README.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# INSTRUCTIONS for installing R, Carpentries, and previewing Sandpaper for multi OS (Linux, Windows and Mac)
2+
3+
## Steps in Ubuntu 22.04 x64
4+
1. Create new repo: https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course
5+
2. Clone repo `git clone https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course`
6+
3. install R (if you haven't done already) [:link:](https://cran.r-project.org/bin/linux/ubuntu/)
7+
```
8+
sudo apt-get install r-cran-xml
9+
sudo apt-get install libxml2-dev
10+
sudo apt install libgit2-dev
11+
sudo apt install r-cran-curl
12+
13+
```
14+
4. Open R and run the following to install dependencies
15+
```
16+
options(repos = c(
17+
carpentries = "https://carpentries.r-universe.dev/",
18+
CRAN = "https://cran.rstudio.com/"
19+
))
20+
install.packages(c("remotes"), dep =TRUE)
21+
```
22+
23+
5. In R, run
24+
```
25+
remotes::install_github("HealthBioscienceIDEAS/sandpaper", dependencies = TRUE)
26+
# this one is taking some 20mins the fist time as it seems is building various packages
27+
# Terminal logs
28+
Downloading GitHub repo HealthBioscienceIDEAS/sandpaper@HEAD
29+
These packages have more recent versions available.
30+
It is recommended to update all of them.
31+
Which would you like to update?
32+
33+
1: All
34+
2: CRAN packages only
35+
3: None
36+
4: pegboard (0.7.5 -> a32a7836d...) [GitHub]
37+
5: varnish (1.0.2 -> 56d594d27...) [GitHub]
38+
6: curl (4.3.2 -> 5.2.1 ) [CRAN]
39+
7: httr (1.4.2 -> 1.4.7 ) [CRAN]
40+
8: gh (1.3.0 -> 1.4.1 ) [CRAN]
41+
9: covr (3.5.1 -> 3.6.4 ) [CRAN]
42+
43+
Enter one or more numbers, or an empty line to skip updates: 1
44+
45+
The downloaded source packages are in
46+
‘/tmp/Rtmpn94NAu/downloaded_packages’
47+
Downloading GitHub repo carpentries/pegboard@HEAD
48+
These packages have more recent versions available.
49+
It is recommended to update all of them.
50+
Which would you like to update?
51+
52+
1: All
53+
2: CRAN packages only
54+
3: None
55+
4: tinkr (0.2.0.9000 -> be564d524...) [GitHub]
56+
57+
Enter one or more numbers, or an empty line to skip updates: 1
58+
59+
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
60+
✔ checking for file ‘/tmp/Rtmpn94NAu/remotes50ddb31b7ca85/HealthBioscienceIDEAS-sandpaper-fb14e02/DESCRIPTION’ ...
61+
─ preparing ‘sandpaper’:
62+
✔ checking DESCRIPTION meta-information ...
63+
─ checking for LF line-endings in source and make files and shell scripts (420ms)
64+
─ checking for empty or unneeded directories
65+
Omitted ‘LazyData’ from DESCRIPTION
66+
─ building ‘sandpaper_0.16.4.tar.gz’
67+
68+
Installing package into ‘/home/mxochicale/R/x86_64-pc-linux-gnu-library/4.4’
69+
(as ‘lib’ is unspecified)
70+
* installing *source* package ‘sandpaper’ ...
71+
** using staged installation
72+
** R
73+
** inst
74+
** byte-compile and prepare package for lazy loading
75+
** help
76+
*** installing help indices
77+
*** copying figures
78+
** building package indices
79+
** installing vignettes
80+
** testing if installed package can be loaded from temporary location
81+
** testing if installed package can be loaded from final location
82+
** testing if installed package keeps a record of temporary installation path
83+
* DONE (sandpaper)
84+
Warning message:
85+
In i.p(...) : installation of package ‘curl’ had non-zero exit status
86+
87+
```
88+
89+
6. In R, run
90+
```
91+
sandpaper::create_lesson("~/Desktop/medical-registration/Medical-Image-Registration-Short-Course")
92+
## LOGS
93+
94+
> sandpaper::create_lesson("~/Desktop/medical-registration/Medical-Image-Registration-Short-Course")
95+
No personal access token (PAT) available.gistration/Medical-Image-Registration-Short-Course...
96+
Obtain a PAT from here:
97+
https://github.com/settings/tokens
98+
For more on what to do with the PAT, see ?gh_whoami.
99+
ℹ No schedule set, using Rmd files in episodes/ directory.
100+
→ To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.
101+
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
102+
ℹ To save this configuration, use
103+
104+
set_episodes(path = path, order = ep, write = TRUE)
105+
• Edit '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/episodes/introduction.Rmd'
106+
✔ First episode created in /home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/episodes/introduction.Rmd
107+
ℹ Workflows up-to-date!
108+
✔ Lesson successfully created in ~/Desktop/medical-registration/Medical-Image-Registration-Short-Course
109+
✔ Setting active project to '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course'
110+
✔ Changing working directory to '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/'
111+
~/Desktop/medical-registration/Medical-Image-Registration-Short-Course
112+
>
113+
```
114+
115+
7. Setting up config file in sandpaper template:
116+
```
117+
carpentry: 'IDEAS'
118+
title: ''Medical-Image-Registration-Short-Course'
119+
created: '2024-05-13'
120+
source: 'https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course'
121+
varnish: 'HealthBioscienceIDEAS/varnish@IDEAS'
122+
sandpaper: 'HealthBioscienceIDEAS/sandpaper@IDEAS'
123+
```
124+
125+
8. Set up GitHub Pages
126+
* Go go [pages](https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course/settings/pages) and select gh-pages branch with `/root` and click save
127+
* Pass CI [actions](https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course/actions/runs/9064118161)
128+
* :tada: you have created: https://healthbioscienceideas.github.io/Medical-Image-Registration-Short-Course/
129+
130+
131+
## Steps on Windows
132+
133+
### **INSTRUCTIONS for installing R, Carpentries, and Sandpaper on Windows:**
134+
135+
1. Create new repo: https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course
136+
137+
2. Clone repo `git clone https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course`
138+
139+
3. Installing R using the following: https://cran.r-project.org/bin/windows/base/
140+
141+
4. Using the default settings during the installation of **RGUi 4.x.x**
142+
143+
5. From RGui Console, enter the following command:
144+
```
145+
options(repos = c(
146+
carpentries = "https://carpentries.r-universe.dev/",
147+
CRAN = "https://cran.rstudio.com/"
148+
))
149+
install.packages(c("remotes"), dep =TRUE)
150+
```
151+
152+
6. Enter the following command:
153+
`remotes::install_github("HealthBioscienceIDEAS/sandpaper", dependencies = TRUE)
154+
`
155+
7. Change path from RGUi to the GitHub folder of the medical image registration course. This is done from the Menu list by picking 'File' then 'Change Dir..'
156+
157+
8. Run the following command to start sandpaper:
158+
`sandpaper::build_lesson()
159+
`
160+
9. You may notice some package not installed called _**Pandoc**_ after running the sandpaper command. If so, install Pandoc then run _step 8_ again.
161+
Pandoc installation: https://pandoc.org/installing.html
162+
163+
164+
165+
## Steps in MAC
166+
Packages via homebrew: freetype, fribidi, harfbuzz, libpng, git2.
167+
168+
169+
## Previewing eposides in any OS platform
170+
1. Using your terminal clone repo
171+
```
172+
git clone git@github.com:HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course.git
173+
```
174+
175+
2. Checkout `feature-branch-name`.
176+
```
177+
git checkout feature-branch-name
178+
```
179+
180+
3. Run `sandpaper::build_lesson()` in R which will launch your internet browser with the episode
181+
```
182+
R
183+
sandpaper::build_lesson()
184+
```
185+

config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ contact: 'team@carpentries.org'
6060

6161
# Order of episodes in your lesson
6262
episodes:
63-
- introduction.Rmd
63+
#- introduction.Rmd
64+
- itksnap.Rmd
65+
- excthreesteps.Rmd
6466

6567
# Information for Learners
6668
learners:

0 commit comments

Comments
 (0)