Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masking Models #95

Merged
merged 6 commits into from
Mar 29, 2018
Merged

Masking Models #95

merged 6 commits into from
Mar 29, 2018

Conversation

andreas-schneider
Copy link

@andreas-schneider andreas-schneider commented Mar 28, 2018

Compute the marginal of a MoMo on a set of points.

  • Computes marginal on MoMoBasic and MoMoExpress.
  • Can be used to mask a model.

How to create a masked model:

  • Define a mask on the reference mesh.
  • Create the masked model.
    Snippet:
    val model: MoMo = ???
    val fix = Point(-71.2, 12.8, 39.9)
    val op: MeshCompactifier = model.referenceMesh.operations.maskSpatially(pt => (pt-fix).norm > 100.0)
    val maskedMesh = op.transformedMesh
    val oldIds = maskedMesh.triangulation.pointIds.map(op.pointBackMap)
    val maskedMoMo = model.marginal(oldIds)

@Andreas-Forster
Copy link
Member

I think the functionality is useful for some applications. But the interpretability of the model is somehow changed. An orthogonal basis will most probably no longer be orthogonal if we just "mask" the model. Could this be problematic for some of the model operations? If yes, can we find a way to communicate this to our software users? Having not thought through all implications of this model transformation I find it dangerous to provide this in our core library. But maybe my concerns can be disproven.

@andreas-schneider
Copy link
Author

Yes orthogonality is lost:

    def orthognality[A](gp: PancakeDLRGP[_3D, UnstructuredPointsDomain[_3D], A]) = {
      def getCol(c: Int) = gp.basisMatrix(::, c)
      getCol(0).dot(getCol(1))
    }
    println(orthognality(model.neutralModel.shape))
    println(orthognality(maskedMoMo.neutralModel.shape))

Output:

original model: 7.235728834674438E-11
masked model: 0.021161337168098197

Do you think that orthogonality is a necessary requirement for the MoMo or is it only required for the DiscreteLowRankGaussianProcess?

@Andreas-Forster
Copy link
Member

We should check the interface of momo if any function assumes orthogonality. For example, is
def project(sample: VertexColorMesh3D)
still well defined?

@Ghazi-Bouabene
Copy link
Member

For masking the shape, the same functionality exists in Scalismo by using the marginal method of DLRGP.
I saw that the PancakeDLRGP also implements this functionality. This should correctly preserve the same basis for the "masked" model.

@andreas-schneider
Copy link
Author

@Ghazi-Bouabene thanks! This makes the whole thing much simpler. I updated the PR accordingly.

Will the orthogonality issue be solved by using the marginal?

@andreas-schneider
Copy link
Author

Integrated marginal into MoMo.

@Andreas-Forster Andreas-Forster merged commit 6f01292 into master Mar 29, 2018
@Andreas-Forster Andreas-Forster deleted the feature-model-masking branch March 29, 2018 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants