samedi 25 juillet 2015

Test that checks the numeric values

I have the following code portion that creates a VTK line which will be used for sampling:

    line = vtk.vtkLineSource()
    line.SetResolution(100)
    line.SetPoint1(self.rulerStartPoint[0], self.rulerStartPoint[1], self.rulerStartPoint[2])
    line.SetPoint2(self.rulerEndPoint[0], self.rulerEndPoint[1], self.rulerEndPoint[2])

    # create VTK probe filter and sample the image
    probe = vtk.vtkProbeFilter()
    probe.SetInputConnection(line.GetOutputPort())
    probe.SetSourceData(volumeNode.GetImageData())
    probe.Update()


    # return VTK array
    return probe.GetOutput().GetPointData().GetArray('ImageScalars')

How can I a test that checks the numeric values of the sample and fails if a mismatch occurs? Would the function IsNumeric() be useful here?

Thanks.

Aucun commentaire:

Enregistrer un commentaire