Skip to content

Commit

Permalink
Initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dennes committed Sep 30, 2019
1 parent 4e00f6b commit d539296
Show file tree
Hide file tree
Showing 62 changed files with 1,322,937 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
*.class
*.log
*.iml
*.ipr
*.iws
.idea
out
.cache/
.history/
.lib/
dist/*
target/
bin/
libexec/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
logs/
project/*-shim.sbt
project/project/
project/target/
target/
.scala_dependencies
.worksheet
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
# icp-proposal
Source code to the paper "A Closest Point Proposal for MCMC-based Probabilistic Surface Registration"
# A Closest Point Proposal for MCMC-based Probabilistic Surface Registration

This repository contains all the code to reproduce our results from our recent publication:
- Dennis Madsen, Andreas Morel-Forster, Patrick Kahr, Dana Rahbani, Thomas Vetter and Marcel Lüthi ["A Closest Point Proposal for MCMC-based Probabilistic Surface Registration"](https://arxiv.org/abs/1907.01414)
IN: arXiv preprint (2019)

Markov Chain Monte Carlo for shape registration with examples using [Scalismo](https://github.com/unibas-gravis/scalismo).


## Overview


## Femur experiments
The experiments are found under *apps/femur*. The repository already contains Gaussian Process Morphable Models (GPMMs) of the femur - approximated with 50 and 100 basis functions.
A synthetic target is also provided.
Without downloading the full test dataset from SMIR, the registration can be performed on the target mesh.

- **IcpRegistration**: Perform a normal ICP registration.
- **IcpProposalRegistration**: Performs a probabilistic registration using *our* method described in the paper.
- **GreateGPmodel**: Create a new GPMM with a user defined number of basis functions.

The log file for the target registration with 100.000 samples is avilable, the following scripts can be used for replay and visualisation:

- **ReplayFittingFromLog**: Replay a fitting from a log file
- **PosteriorVariabilityToMeshColor**: Create a color map on the MAP solution to visualise the registration uncertainty

### Data preparation
The test dataset we use is the same as used in the [Statistical Shape Modelling course on futurelearn](https://www.futurelearn.com/courses/statistical-shape-modelling) and can be downloaded from SMIR:
[comment]: <> (Registration procedure from the SSM course <https://www.futurelearn.com/courses/statistical-shape-modelling/0/steps/16884>)

- Go to the [SMIR registraiton page](https://www.smir.ch/Account/Register).
- Fill in your details, and select **SSM.FUTURELEARN.COM** as a research unit.
- *This will send a request to an administrator to authorize your account creation. Please bare in mind that this might take **up to 24h**. You will be informed by Email once your account creation is authorized.*
- Follow the [instructions on Sicas Medical Image Repository (SMIR)](https://www.smir.ch/courses/FutureLearnSSM/2016) to download the required femur surfaces and corresponding landmarks.
- We only use the data from **Step 2** of the project
- Extract the folder under **data/femur/SMIR**, such that the mesh **0.stl** can be found under **data/femur/SMIR/step2/meshes**
- Align all the test meshes to the model by running the **apps/femur/AlignShapes** script

To compare the Markov-Chain random-walk to our ICP-proposal, run the script: **apps/femur/RunMHrandomInitComparson**. This script will start 5 fittings in parallel with different initial starting points for the femur GPMM.

To compare the standard ICP fitting to our ICP-proposal either with Euclidean average evaluator or Hausdorff evaluator, run the script: **apps/femur/StdIcpVsChainICPrandomInitComparsonAll**. This will perform registration on all the femurs from SMIR and do so 100 times for each mesh, each registration having a different initial starting point for the femur GPMM.


## BFM experiments

### Data preparation
Download the Basel Face Model (BFM) 2017 <https://faces.dmi.unibas.ch/bfm/bfm2017.html>.
For the experiments we use the cropped model: **model2017-1_face12_nomouth.h5**, which is cropped to the face region.
Place the model such that it is located: **data/bfm/model2017-1_face12_nomouth.h5** (same place where our provided **bfm.json** landmark file is located).

The test face scans are available here: <https://faces.dmi.unibas.ch/bfm/main.php?nav=1-2&id=downloads>

- **Download the 3D face scans & renderings of ten individuals (94 MB)**.
- Unpack the scans in the bfm/initial folder such that the .ply meshes are to be found under **data/bfm/initial/PublicMM1/03_scans_ply**.
- Then run the **apps/bfm/AlignShapes** script to scale and align all faces to the face model as well as creating partial target meshes.

To run the face registration, run the script: **apps/bfm/BfmFitting**.
As with the femur, the face registration can be replayed and the posterior can be visualised with the similar scripts found under **apps/bfm/**.
21 changes: 21 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
organization := "ch.unibas.cs.gravis"

name := """ICP-PROPOSAL-REGISTRATION"""

version := "0.1"

scalaVersion := "2.12.8"

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")

resolvers += Resolver.bintrayRepo("unibas-gravis", "maven")


libraryDependencies ++= Seq(
"ch.unibas.cs.gravis" %% "scalismo-ui" % "0.13.0",
"ch.unibas.cs.gravis" %% "scalismo-faces" % "0.9.0",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.0"
).map(_.force())

libraryDependencies ~= { _.map(_.exclude("org.slf4j", "slf4j-nop")) }
1 change: 1 addition & 0 deletions data/bfm/bfm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-23.70504379272461,-33.45827865600586,98.3342056274414],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"right.eye.corner_outer","coordinates":[-44.02754592895508,32.43998718261719,86.61490631103516],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"left.eye.corner_outer","coordinates":[43.03085708618164,32.5797233581543,86.72027587890625],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"left.lips.corner","coordinates":[23.517236709594727,-33.23805618286133,97.9552230834961],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"center.nose.attachement_to_philtrum","coordinates":[0.025348693132400513,-10.950613975524902,116.14006042480469],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"center.lips.lower.inner","coordinates":[-0.008524144068360329,-32.59530258178711,109.80796813964844],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"right.eye.corner_inner","coordinates":[-17.09498405456543,31.7714786529541,93.12824249267578],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"center.lips.upper.inner","coordinates":[0.0029204045422375202,-32.44647216796875,109.90381622314453],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"left.eye.corner_inner","coordinates":[16.157331466674805,31.860828399658203,92.98885345458984],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}},{"id":"center.nose.tip","coordinates":[0.2037338763475418,0.9716929197311401,131.8238067626953],"uncertainty":{"stddevs":[1.0,1.0,1.0],"pcvectors":[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]}}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-26386.80078125,-32895.8984375,96901.5]},{"id":"right.eye.corner_outer","coordinates":[-39408.5,32386.69921875,86316.296875]},{"id":"left.eye.corner_outer","coordinates":[40527.19921875,34751.30078125,85495.3984375]},{"id":"left.lips.corner","coordinates":[24573.599609375,-33124.1015625,100536.0]},{"id":"center.nose.attachement_to_philtrum","coordinates":[-1378.3399658203125,-6920.330078125,113966.0]},{"id":"center.lips.lower.inner","coordinates":[-1409.2900390625,-32576.69921875,112032.0]},{"id":"right.eye.corner_inner","coordinates":[-15984.599609375,32022.30078125,91992.0]},{"id":"center.lips.upper.inner","coordinates":[-1276.2099609375,-32489.900390625,110773.0]},{"id":"left.eye.corner_inner","coordinates":[16252.900390625,33577.30078125,90930.8984375]},{"id":"center.nose.tip","coordinates":[-352.55499267578125,6086.08984375,127844.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-31260.900390625,-36094.0,98094.0]},{"id":"right.eye.corner_outer","coordinates":[-46579.3984375,36222.6015625,87072.203125]},{"id":"left.eye.corner_outer","coordinates":[45914.19921875,36131.5,88280.203125]},{"id":"left.lips.corner","coordinates":[32158.900390625,-36695.6015625,97069.296875]},{"id":"center.nose.attachement_to_philtrum","coordinates":[271.79901123046875,-9521.400390625,116536.0]},{"id":"center.lips.lower.inner","coordinates":[54.65290069580078,-33381.69921875,112619.0]},{"id":"right.eye.corner_inner","coordinates":[-19905.0,33315.6015625,90245.1015625]},{"id":"center.lips.upper.inner","coordinates":[20.615999221801758,-33449.1015625,111597.0]},{"id":"left.eye.corner_inner","coordinates":[18035.099609375,32958.6015625,91703.296875]},{"id":"center.nose.tip","coordinates":[50.345401763916016,2536.0,130970.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-32588.30078125,-38092.8984375,104178.0]},{"id":"right.eye.corner_outer","coordinates":[-44006.30078125,35028.1015625,98317.1015625]},{"id":"left.eye.corner_outer","coordinates":[43234.6015625,34512.69921875,97731.203125]},{"id":"left.lips.corner","coordinates":[33034.80078125,-37120.1015625,98033.796875]},{"id":"center.nose.attachement_to_philtrum","coordinates":[541.3989868164062,-11624.900390625,125722.0]},{"id":"center.lips.lower.inner","coordinates":[-468.0870056152344,-35267.5,116673.0]},{"id":"right.eye.corner_inner","coordinates":[-22825.30078125,36447.69921875,100983.0]},{"id":"center.lips.upper.inner","coordinates":[-447.2070007324219,-35249.6015625,116493.0]},{"id":"left.eye.corner_inner","coordinates":[20767.099609375,36565.30078125,100610.0]},{"id":"center.nose.tip","coordinates":[552.5139770507812,2598.830078125,145623.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-31285.30078125,-35982.0,100527.0]},{"id":"right.eye.corner_outer","coordinates":[-42734.69921875,35590.30078125,86028.8984375]},{"id":"left.eye.corner_outer","coordinates":[43905.1015625,35127.6015625,86857.0]},{"id":"left.lips.corner","coordinates":[30538.69921875,-35514.8984375,100328.0]},{"id":"center.nose.attachement_to_philtrum","coordinates":[-399.5400085449219,-11605.5,120448.0]},{"id":"center.lips.lower.inner","coordinates":[-173.48500061035156,-32537.5,112792.0]},{"id":"right.eye.corner_inner","coordinates":[-17828.400390625,35931.0,88701.3984375]},{"id":"center.lips.upper.inner","coordinates":[-186.58700561523438,-32512.5,113600.0]},{"id":"left.eye.corner_inner","coordinates":[17135.099609375,34000.19921875,90094.3984375]},{"id":"center.nose.tip","coordinates":[-242.89500427246094,2291.60009765625,139938.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-26957.599609375,-35599.30078125,98134.8984375]},{"id":"right.eye.corner_outer","coordinates":[-41341.0,33760.6015625,90326.8984375]},{"id":"left.eye.corner_outer","coordinates":[37026.0,31917.30078125,89084.796875]},{"id":"left.lips.corner","coordinates":[27826.099609375,-35325.30078125,97835.5]},{"id":"center.nose.attachement_to_philtrum","coordinates":[192.73399353027344,-8650.7001953125,116927.0]},{"id":"center.lips.lower.inner","coordinates":[585.1069946289062,-30193.099609375,114271.0]},{"id":"right.eye.corner_inner","coordinates":[-17234.900390625,33148.3984375,89772.6015625]},{"id":"center.lips.upper.inner","coordinates":[886.1060180664062,-30168.599609375,113855.0]},{"id":"left.eye.corner_inner","coordinates":[15428.5,33071.5,91118.1015625]},{"id":"center.nose.tip","coordinates":[-439.9330139160156,6280.43017578125,133627.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-31265.900390625,-34282.8984375,100426.0]},{"id":"right.eye.corner_outer","coordinates":[-45789.80078125,35816.6015625,91414.5]},{"id":"left.eye.corner_outer","coordinates":[42930.69921875,34732.3984375,89108.796875]},{"id":"left.lips.corner","coordinates":[27094.400390625,-32434.599609375,102762.0]},{"id":"center.nose.attachement_to_philtrum","coordinates":[-1634.0799560546875,-12233.0,120786.0]},{"id":"center.lips.lower.inner","coordinates":[-1846.3900146484375,-31701.80078125,117166.0]},{"id":"right.eye.corner_inner","coordinates":[-22389.80078125,36416.69921875,93302.8984375]},{"id":"center.lips.upper.inner","coordinates":[-1753.4000244140625,-31673.0,116956.0]},{"id":"left.eye.corner_inner","coordinates":[18443.599609375,33230.69921875,92023.203125]},{"id":"center.nose.tip","coordinates":[-737.614013671875,1339.47998046875,137887.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-24541.30078125,-33613.19921875,96987.0]},{"id":"right.eye.corner_outer","coordinates":[-42045.30078125,31008.30078125,86512.5]},{"id":"left.eye.corner_outer","coordinates":[41705.8984375,32255.900390625,87143.1015625]},{"id":"left.lips.corner","coordinates":[23839.900390625,-33001.1015625,96402.796875]},{"id":"center.nose.attachement_to_philtrum","coordinates":[687.3090209960938,-12907.599609375,114461.0]},{"id":"center.lips.lower.inner","coordinates":[202.19500732421875,-29984.69921875,107147.0]},{"id":"right.eye.corner_inner","coordinates":[-18769.19921875,31116.5,89979.8984375]},{"id":"center.lips.upper.inner","coordinates":[296.9729919433594,-30009.099609375,107595.0]},{"id":"left.eye.corner_inner","coordinates":[16896.69921875,31157.900390625,89708.0]},{"id":"center.nose.tip","coordinates":[1560.2099609375,-1537.239990234375,129089.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-30636.19921875,-36973.69921875,102372.0]},{"id":"right.eye.corner_outer","coordinates":[-45886.8984375,34014.0,85175.203125]},{"id":"left.eye.corner_outer","coordinates":[45752.69921875,33567.30078125,84525.3984375]},{"id":"left.lips.corner","coordinates":[29694.5,-35534.1015625,103534.0]},{"id":"center.nose.attachement_to_philtrum","coordinates":[-166.73599243164062,-9435.0400390625,119668.0]},{"id":"center.lips.lower.inner","coordinates":[-590.2050170898438,-34249.3984375,117428.0]},{"id":"right.eye.corner_inner","coordinates":[-19836.400390625,32938.19921875,90483.796875]},{"id":"center.lips.upper.inner","coordinates":[-604.8900146484375,-34037.19921875,116589.0]},{"id":"left.eye.corner_inner","coordinates":[19390.19921875,33241.8984375,90409.5]},{"id":"center.nose.tip","coordinates":[508.57000732421875,932.7730102539062,135172.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-25506.69921875,-30769.80078125,97881.703125]},{"id":"right.eye.corner_outer","coordinates":[-39942.19921875,30399.30078125,86395.5]},{"id":"left.eye.corner_outer","coordinates":[41242.30078125,31522.099609375,87008.1015625]},{"id":"left.lips.corner","coordinates":[24384.19921875,-30561.0,96874.5]},{"id":"center.nose.attachement_to_philtrum","coordinates":[-1020.4600219726562,-11492.7001953125,111714.0]},{"id":"center.lips.lower.inner","coordinates":[-658.3060302734375,-29307.099609375,106368.0]},{"id":"right.eye.corner_inner","coordinates":[-15498.5,31973.30078125,89772.1015625]},{"id":"center.lips.upper.inner","coordinates":[-646.7940063476562,-29215.30078125,105951.0]},{"id":"left.eye.corner_inner","coordinates":[14825.599609375,32194.19921875,90476.203125]},{"id":"center.nose.tip","coordinates":[-262.6809997558594,-38.12889862060547,127486.0]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"right.lips.corner","coordinates":[-26618.5,-31851.599609375,96263.1015625]},{"id":"right.eye.corner_outer","coordinates":[-36791.5,32146.5,86246.796875]},{"id":"left.eye.corner_outer","coordinates":[36930.80078125,31687.19921875,85666.8984375]},{"id":"left.lips.corner","coordinates":[25294.80078125,-31537.599609375,95810.0]},{"id":"center.nose.attachement_to_philtrum","coordinates":[593.97900390625,-10006.7998046875,112068.0]},{"id":"center.lips.lower.inner","coordinates":[-212.6179962158203,-29861.80078125,107366.0]},{"id":"right.eye.corner_inner","coordinates":[-13456.7998046875,33079.6015625,89591.1015625]},{"id":"center.lips.upper.inner","coordinates":[-205.88299560546875,-29657.400390625,107700.0]},{"id":"left.eye.corner_inner","coordinates":[11856.599609375,30938.099609375,89930.796875]},{"id":"center.nose.tip","coordinates":[1187.8299560546875,1860.300048828125,126372.0]}]
Loading

0 comments on commit d539296

Please sign in to comment.