Beispiel #1
0
    def addCatheter(self, catheter=None, coords=None):
        print("cathType {}".format(type(catheter)))

        if catheter is None:
            row, col = coords
            catheter = CatheterObj(rowNumber=float(row), colLetter=col)
            catheter.makePlottable()

        if type(catheter) is tuple:
            catheter = catheter[0]

        if type(catheter) is CatheterObj:
            catheter.setParent(self)

            self.CatheterList.append(catheter)
            print('adding catheter {} {}'.format(len(self.CatheterList),
                                                 self.CatheterList))

        self.activeCath = catheter

        return catheter
Beispiel #2
0
    # [79.329114, 33.750000, -236.000000]]))

    # measurements.append(np.array([[40.0, 20.0, 4.0]]))

    colLetters = ['B', 'f', 'e']
    rowInts = [6, 5, 3.5]

    # colLetters = ['B', 'b', 'C',
    #               'c', 'D', 'd',
    #               'E', 'e', 'F',
    #               'C', 'C', 'E', 'E']
    # rowInts = [3, 2.5, 2,
    #            2, 2, 2,
    #            2, 2.5, 3,
    #            5, 5.5, 5, 5.5]

    for ind, colLetter in enumerate(colLetters):
        newCath = CatheterObj(rowNumber=rowInts[ind], colLetter=colLetter)
        newCath.addDescribingPoint(measurements[ind])
        # newCath.setTemplatePosition(row=4, col='b')
        cathList.append(newCath)

    writer.setCatheterList(cathList)

    # exported_plan_path = r'C:\Users\Mark\Documents\Sunnybrook\semple'
    exported_plan_path = r'P:\USERS\PUBLIC\Mark Semple\EARTh\tests for importing plans\exported sample plan'

    writer.import_plan(exported_plan_path)

    writer.execute()
Beispiel #3
0
        if coords is not None:
            print("FILL IN HERE")
            pass

    def removeCatheter(self, catheter=None):
        targetUID = catheter.uid
        for ind, cath in enumerate(self.CatheterList):
            if cath.uid == targetUID:
                print("a match! catheter being removed")
                del (self.CatheterList[ind])

        N = len(self.CatheterList)
        print("There are {} catheters remaining".format(N))

    def export_as_CHA(self, sourcePath, destPath):
        # self.plan_exporter. DO THING ()
        # sort catheters by bottom row, left to right, then up
        #
        pass


if __name__ == "__main__":
    myPlan = Patient_Plan()
    myCath = CatheterObj()
    myCath.setTemplatePosition_byCode(row=4, col='B')
    myCath.addDescribingPoint([44, 39, -40])
    myCath.finishMeasuring()
    myPlan.addCatheter(myCath)

    print(myPlan.CatheterList[0].measurements)
Beispiel #4
0
def test_template_assignment():
    cath = CatheterObj(row, col)
    assert cath.getTemplateAlphanumeric() == template_coord_string
Beispiel #5
0
def test_get_VirtualCatheter():
    cath = CatheterObj(row, col)
    assert cath.to_virtual_catheter().shape[0] == 4
Beispiel #6
0
def test_premature_closure():
    cath = CatheterObj(row, col)
    assert cath.finishMeasuring() is False
Beispiel #7
0
def test_close_catheter():
    cath = CatheterObj(row, col)
    assert cath.add_raw_measurement(dummyPoints) is True
    assert cath.finishMeasuring() is True
    assert cath.add_raw_measurement(dummyPoints) is False
Beispiel #8
0
def test_catheter_adding_multi_points():
    cath = CatheterObj(row, col)
    assert cath.add_raw_measurement(dummyPoints) is True
    assert cath.has_data() is True
    assert cath.get_N_raw_pts() == 5
    assert cath.get_raw_data().shape == dummyShape
Beispiel #9
0
def test_catheter_add_single_point():
    cath = CatheterObj(row, col)
    cath.add_raw_measurement(dummyPoint)
    assert cath.has_data() is True
    assert cath.get_N_raw_pts() == 1
Beispiel #10
0
def test_catheter_create_empty():
    cath = CatheterObj(row, col)
    assert cath.has_data() is False