60 def process(self, image: Union[Image, ids_peak_ipl.Image]) -> Region:
63 Applies a threshold on a given single-channel image and returns a region with selected pixels
64 whose gray values are in the range Interval.minimum <= gray value <= Interval.maximum.
66 @param image: An image of type Mono8, Mono10, Mono12 or Coord3D.
68 @return Region: Returns a region with selected pixels.
70 @exception OutOfRangeException: If the interval is out of bounds for the pixel format.
71 @exception NotPossibleException: If the image is too big for processing.
73 @since ids_peak_icv 1.1
76 _image = _check_and_get_icv_image(image)
78 image_handle = _image._handle
81 execute_and_map_return_codes(lib_loader.dll().peak_icv_Region_Create,
82 ctypes.pointer(region_handle))
85 c_interval: peak_common_interval | peak_common_interval_f
92 execute_and_map_return_codes(lib_loader.dll().peak_icv_Threshold_Process,
94 ctypes.pointer(c_interval),
95 ctypes.sizeof(c_interval),
96 ctypes.pointer(region_handle))
97 except ICVException
as e:
98 lib_loader.dll().peak_icv_Region_Destroy(region_handle)
101 return Region(_handle=region_handle)
104 def get_range(image: Union[Image, ids_peak_ipl.Image]) -> Interval:
107 Queries the minimum and maximum value of a given image and provides it as an interval.
109 @param image: An image of type Mono8, Mono10, Mono12 or Coord3D.
111 @return Interval: Returns the maximum possible range of the given image.
113 @since ids_peak_icv 1.1
116 _image = _check_and_get_icv_image(image)
118 image_handle = _image._handle
120 c_interval: peak_common_interval | peak_common_interval_f
122 if _image._pixel_format.is_float:
127 execute_and_map_return_codes(lib_loader.dll().peak_icv_Threshold_GetRange,
128 image_handle, ctypes.pointer(c_interval), ctypes.sizeof(c_interval))
129 return Interval(c_interval.minimum, c_interval.maximum)