def create_simple_plan(root_type: RootType, save: Save): parameters = { "channel": 0, "minimum_size": 200, "threshold": { "name": "Manual", "values": { "threshold": 13000 } }, "noise_filtering": { "name": "Gauss", "values": { "dimension_type": DimensionType.Layer, "radius": 1.0 } }, "side_connection": False, } segmentation = ROIExtractionProfile(name="test", algorithm="Lower threshold", values=parameters) chosen_fields = [ MeasurementEntry( name="Segmentation Volume", calculation_tree=Leaf(name="Volume", area=AreaType.ROI, per_component=PerComponent.No), ), ] statistic = MeasurementProfile(name="base_measure", chosen_fields=chosen_fields, name_prefix="") statistic_calculate = MeasurementCalculate( channel=-1, units=Units.µm, measurement_profile=statistic, name_prefix="") tree = CalculationTree( root_type, [ CalculationTree(segmentation, [ CalculationTree(statistic_calculate, []), CalculationTree(save, []) ]) ], ) return CalculationPlan(tree=tree, name="test")
def add_measurement(self): text = str(self.measurements_list.currentItem().text()) measurement_copy = deepcopy(self.settings.measurement_profiles[text]) prefix = str(self.measurement_name_prefix.text()).strip() channel = self.choose_channel_for_measurements.currentIndex() - 1 measurement_copy.name_prefix = prefix # noinspection PyTypeChecker measurement_calculate = MeasurementCalculate( channel=channel, statistic_profile=measurement_copy, name_prefix=prefix, units=self.units_choose.get_value()) if self.update_element_chk.isChecked(): self.calculation_plan.replace_step(measurement_calculate) else: self.calculation_plan.add_step(measurement_calculate) self.plan.update_view()
def create_calculation_plan(): parameters = { "channel": 1, "minimum_size": 200, "threshold": { "name": "Base/Core", "values": { "core_threshold": { "name": "Manual", "values": { "threshold": 30000 } }, "base_threshold": { "name": "Manual", "values": { "threshold": 13000 } }, }, }, "noise_filtering": { "name": "Gauss", "values": { "dimension_type": DimensionType.Layer, "radius": 1.0 } }, "side_connection": False, "sprawl_type": { "name": "Euclidean", "values": {} }, } segmentation = ROIExtractionProfile( name="test", algorithm="Lower threshold with watershed", values=parameters) mask_suffix = MaskSuffix(name="", suffix="_mask") chosen_fields = [ MeasurementEntry( name="Segmentation Volume", calculation_tree=Leaf(name="Volume", area=AreaType.ROI, per_component=PerComponent.No), ), MeasurementEntry( name="Segmentation Volume/Mask Volume", calculation_tree=Node( left=Leaf(name="Volume", area=AreaType.ROI, per_component=PerComponent.No), op="/", right=Leaf(name="Volume", area=AreaType.Mask, per_component=PerComponent.No), ), ), MeasurementEntry( "Segmentation Components Number", calculation_tree=Leaf("Components number", area=AreaType.ROI, per_component=PerComponent.No), ), ] statistic = MeasurementProfile(name="base_measure", chosen_fields=chosen_fields, name_prefix="") statistic_calculate = MeasurementCalculate( channel=0, units=Units.µm, measurement_profile=statistic, name_prefix="") tree = CalculationTree( RootType.Image, [ CalculationTree(mask_suffix, [ CalculationTree(segmentation, [CalculationTree(statistic_calculate, [])]) ]) ], ) return CalculationPlan(tree=tree, name="test")