Skip to content

Commit

Permalink
Merge branch 'release-0.92'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelluethi committed Jun 30, 2023
2 parents 2fe5a79 + 1798f1f commit 476c42e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![build](https://github.com/unibas-gravis/scalismo/actions/workflows/ci.yml/badge.svg) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/ch.unibas.cs.gravis/scalismo_3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ch.unibas.cs.gravis/scalismo_3) [![Gitter](https://badges.gitter.im/unibas-gravis/scalismo.svg)](https://gitter.im/unibas-gravis/scalismo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Scalismo is a library for statistical shape modeling and model-based image analysis in Scala, developed by the
[Graphics and Vision Research Group](http://gravis.cs.unibas.ch) at the [University of Basel](http://www.unibas.ch). It is based on the the concept of [Probabilistic Morphable Models](https://gravis.dmi.unibas.ch/PMM/).
[Graphics and Vision Research Group](https://shapemodelling.cs.unibas.ch/web/about-gravis) at the [University of Basel](http://www.unibas.ch).

The vision of the project is to provide an environment for modelling and image analysis which

Expand All @@ -13,7 +13,7 @@ The vision of the project is to provide an environment for modelling and image a

## Documentation

* The [Scalismo website](https://unibas-gravis.github.io/scalismo-microsite) contains comprehensive documentation including a series of [tutorials](https://unibas-gravis.github.io/scalismo-microsite/tutorials.html), [API doc](http://unibas-gravis.github.io/scalismo/latest/api/index.html) and links to further ressources and papers.
* The [Scalismo website](https://scalismo.org) contains comprehensive documentation including a series of [tutorials](https://scalismo.org/docs), [API doc](http://unibas-gravis.github.io/scalismo/latest/api/index.html) and links to further ressources and papers.

## How can I help?
While scalismo is already fully usable for shape modeling and simple image processing task, its functionality is currently targeted
Expand All @@ -24,7 +24,7 @@ We welcome contributions to scalismo. Please check the [Contributor's guide](con
We are also always grateful if you report bugs or if give us feedback on how you use scalismo in your work and how you think we can improve it.

## Maintainers
The project is developed and maintained by the [Graphics and Vision Research group](https://gravis.dmi.unibas.ch), [University of Basel](https://www.unibas.ch) in collaboration with [Shapemeans GmbH](https://www.shapemeans.com).
The project is developed and maintained by the [University of Basel](https://www.unibas.ch) in collaboration with [Shapemeans GmbH](https://www.shapemeans.com).
The current maintainers of the project (people who can merge pull requests) are:

* [Ghazi Bouabene](https://github.com/ghazi-bouabene)
Expand All @@ -48,5 +48,5 @@ The design of the registration approach used in scalismo is strongly influenced
## Copyright and License
All code is available to you under the Apache license, version 2, available at http://www.apache.org/licenses/LICENSE-2.0.

Copyright, University of Basel, 2015.
Copyright, University of Basel, 2023.

2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sbt.Resolver

ThisBuild / version := "0.92-RC1"
ThisBuild / version := "0.92.0"

Test / parallelExecution := false

Expand Down
24 changes: 14 additions & 10 deletions src/main/scala/scalismo/numerics/Sampler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ trait Sampler[D] {
val numberOfPoints: Int

/**
* sample n points (x_1, ... x_n), yielding an sequence of (x_i, p(x_i)), i=1..n , p is the probability density
* generates a sequence of [[numberOfPoints]] sample points (x_i, p(x_i)), i=1..n , where p is the probability density
* function according to which the points are sampled
*/
def sample(): IndexedSeq[(Point[D], Double)]

/**
* generates a sequence of [[numberOfPoints]] points.
*/
def samplePoints(): IndexedSeq[Point[D]] = sample().map(_._1)

def volumeOfSampleRegion: Double
}

Expand Down Expand Up @@ -149,8 +154,8 @@ case class UniformMeshSampler3D(mesh: TriangleMesh[_3D], numberOfPoints: Int)(im
case class FixedPointsUniformMeshSampler3D(mesh: TriangleMesh[_3D], numberOfPoints: Int)(implicit rng: Random)
extends Sampler[_3D] {
override val volumeOfSampleRegion = mesh.area
val samplePoints = UniformMeshSampler3D(mesh, numberOfPoints).sample()
override def sample() = samplePoints
val samplePointsWithProbability = UniformMeshSampler3D(mesh, numberOfPoints).sample()
override def sample() = samplePointsWithProbability
}

case class FixedPointsMeshSampler3D(mesh: TriangleMesh[_3D], numberOfPoints: Int)(implicit rand: Random)
Expand All @@ -161,7 +166,7 @@ case class FixedPointsMeshSampler3D(mesh: TriangleMesh[_3D], numberOfPoints: Int

val meshPoints = mesh.pointSet.points.toIndexedSeq

def samplePoints = for (i <- 0 until numberOfPoints) yield {
override def samplePoints() = for (i <- 0 until numberOfPoints) yield {
val idx = rand.scalaRandom.nextInt(mesh.pointSet.numberOfPoints)
meshPoints(idx)
}
Expand All @@ -173,7 +178,7 @@ case class FixedPointsMeshSampler3D(mesh: TriangleMesh[_3D], numberOfPoints: Int
lastSampledPoints match {
case Some(lastSampledPoints) => lastSampledPoints
case None => {
val pts = samplePoints.map(pt => (pt, p))
val pts = samplePoints().map(pt => (pt, p))
lastSampledPoints = Some(pts)
pts
}
Expand Down Expand Up @@ -232,8 +237,8 @@ case class FixedPointsUniformTetrahedralMeshSampler3D(mesh: TetrahedralMesh[_3D]
rng: Random
) extends Sampler[_3D] {
override val volumeOfSampleRegion = mesh.volume
val samplePoints = UniformTetrahedralMeshSampler3D(mesh, numberOfPoints).sample()
override def sample() = samplePoints
val samplePointsWithProbability = UniformTetrahedralMeshSampler3D(mesh, numberOfPoints).sample()
override def sample() = samplePointsWithProbability
}

case class FixedPointsTetrahedralMeshSampler3D(mesh: TetrahedralMesh[_3D], numberOfPoints: Int)(implicit rand: Random)
Expand All @@ -244,7 +249,7 @@ case class FixedPointsTetrahedralMeshSampler3D(mesh: TetrahedralMesh[_3D], numbe

val meshPoints = mesh.pointSet.points.toIndexedSeq

def samplePoints = for (i <- 0 until numberOfPoints) yield {
override def samplePoints() = for (i <- 0 until numberOfPoints) yield {
val idx = rand.scalaRandom.nextInt(mesh.pointSet.numberOfPoints)
meshPoints(idx)
}
Expand All @@ -256,11 +261,10 @@ case class FixedPointsTetrahedralMeshSampler3D(mesh: TetrahedralMesh[_3D], numbe
lastSampledPoints match {
case Some(lastSampledPoints) => lastSampledPoints
case None => {
val pts = samplePoints.map(pt => (pt, p))
val pts = samplePoints().map(pt => (pt, p))
lastSampledPoints = Some(pts)
pts
}

}
}
}

0 comments on commit 476c42e

Please sign in to comment.