Пример #1
0
    def test_align_invert(self):
        """Test for the inverted ICP. The transformations should be the same."""
        al = align(self.amp1, self.amp2, inverse=False)

        al_inv = align(self.amp2, self.amp1, inverse=True)

        print(al.R)
        print(al_inv.R)

        print(al.T)
        print(al_inv.T)
Пример #2
0
 def test_align_points(self):
     """Test that the shape can be aligned to -5mm in z axis"""
     mv = [[0, 0, 5], [5, 0, 5], [0, 5, 5]]
     sv = [[0, 0, 0], [5, 0, 0], [0, 5, 0]]
     al = align(self.amp1, self.amp2, mv=mv, sv=sv, method='contPoints').m
     zMax = self.amp1.vert[:, 2].max() - 5
     # Both objects are already centered, so should be close to origin (allowing for some inaccuracy)
     self.assertAlmostEqual(al.vert[:, 2].max(),
                            zMax,
                            delta=TestAlign.DELTA)
Пример #3
0
 def test_align_idx(self):
     """Test that the shape can be using idxPoints"""
     self.amp4.rotateAng([5, 5, 5], ang='deg')
     al = align(self.amp3,
                self.amp4,
                mv=[0, 1, 2, 3],
                sv=[0, 1, 2, 3],
                method='idxPoints')
     all(
         self.assertAlmostEqual(al.m.vert[i, 0], al.s.vert[i, 0], delta=0.1)
         for i in range(al.s.vert.shape[0]))
Пример #4
0
    def test_align(self):
        """Test that objects that are already centered on origin are aligned correctly"""
        al = align(self.amp1, self.amp2).m

        # Both objects are already centered, so should be close to origin (allowing for some inaccuracy)
        self.assertAlmostEqual(al.vert.mean(axis=0)[0],
                               0,
                               delta=TestAlign.DELTA)
        self.assertAlmostEqual(al.vert.mean(axis=0)[1],
                               0,
                               delta=TestAlign.DELTA)
        self.assertAlmostEqual(al.vert.mean(axis=0)[2],
                               0,
                               delta=TestAlign.DELTA)
Пример #5
0
def icp_view(request):
    """
    View for aligning
    """
    # TODO add options to adjust settings

    # AmpScan ICP alignment
    static = get_session(request).get_obj(request.POST.get("staticID"))
    moving = get_session(request).get_obj(request.POST.get("movingID"))
    al = align(moving, static, maxiter=10, method='linPoint2Plane').m

    new_name = request.POST.get("movingID")
    get_session(request).add_obj(al, new_name)

    return JsonResponse({"success": True, "newObjID": new_name})