Пример #1
0
 def test_02_01_get_measurement_columns(self):
     module = mia.MeasureImageAreaOccupied()
     module.operands[0].operand_objects.value = OBJECTS_NAME
     module.operands[0].operand_choice.value = "Objects"
     columns = module.get_measurement_columns(None)
     expected = ((cpmm.IMAGE, "AreaOccupied_AreaOccupied_%s" % OBJECTS_NAME,
                  cpmm.COLTYPE_FLOAT),
                 (cpmm.IMAGE, "AreaOccupied_Perimeter_%s" % OBJECTS_NAME,
                  cpmm.COLTYPE_FLOAT),
                 (cpmm.IMAGE, "AreaOccupied_TotalArea_%s" % OBJECTS_NAME,
                  cpmm.COLTYPE_FLOAT))
     self.assertEqual(len(columns), len(expected))
     for column in columns:
         self.assertTrue(any([all([cf == ef for cf, ef in zip(column, ex)])
                              for ex in expected]))
Пример #2
0
    def make_workspace(self, labels, parent_image=None):
        object_set = cpo.ObjectSet()
        objects = cpo.Objects()
        objects.segmented = labels
        objects.parent_image = parent_image
        object_set.add_objects(objects, OBJECTS_NAME)

        pipeline = cpp.Pipeline()
        module = mia.MeasureImageAreaOccupied()
        module.module_num = 1
        module.operands[0].operand_objects.value = OBJECTS_NAME
        pipeline.add_module(module)
        image_set_list = cpi.ImageSetList()
        workspace = cpw.Workspace(pipeline, module,
                                  image_set_list.get_image_set(0), object_set,
                                  cpmm.Measurements(), image_set_list)
        return workspace