Skip to content
Snippets Groups Projects
Commit 48234c5b authored by Kai Schleicher's avatar Kai Schleicher
Browse files

Add minimun spot diameter as parameter

parent d6ed724d
No related branches found
No related tags found
1 merge request!2Initial commit
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#@ Integer (label="DAPI threshold", description="0 = Auto", min=0) threshold #@ Integer (label="DAPI threshold", description="0 = Auto", min=0) threshold
#@ String (label="processing channels", description="comma separated list of channels, e.g. 2,3,6,7", value="1,2,3,4") processing_channels_string #@ String (label="processing channels", description="comma separated list of channels, e.g. 2,3,6,7", value="1,2,3,4") processing_channels_string
#@ String (label="Spot detection quality threshold", description="comma separated list of values, one per channel", value="80,80,80,80" ) quality_thresholds_string #@ String (label="Spot detection quality threshold", description="comma separated list of values, one per channel", value="80,80,80,80" ) quality_thresholds_string
#@ Double (label="Minimum spot diameter", description="smaller spots will be discarded, value=5, min=1, max=200, stepSize=0.5, persist=false, style=slider) spot_diameter
# trackmate imports # trackmate imports
from fiji.plugin.trackmate import Settings from fiji.plugin.trackmate import Settings
...@@ -274,7 +274,7 @@ def BFopen_image(path_to_image, channel_number, series_number, region=None, z_sl ...@@ -274,7 +274,7 @@ def BFopen_image(path_to_image, channel_number, series_number, region=None, z_sl
return imps[0] return imps[0]
def run_trackmate_dog_spot_detector(imp, quality_threshold): def run_trackmate_dog_spot_detector(imp, spot_diameter, quality_threshold):
"""Run TrackMates DoG detector with a given quality threshold """Run TrackMates DoG detector with a given quality threshold
on a target image on a target image
...@@ -296,7 +296,7 @@ def run_trackmate_dog_spot_detector(imp, quality_threshold): ...@@ -296,7 +296,7 @@ def run_trackmate_dog_spot_detector(imp, quality_threshold):
settings.detectorFactory = DogDetectorFactory() settings.detectorFactory = DogDetectorFactory()
settings.detectorSettings['DO_SUBPIXEL_LOCALIZATION'] = True settings.detectorSettings['DO_SUBPIXEL_LOCALIZATION'] = True
settings.detectorSettings['RADIUS'] = 0.15 # type = double settings.detectorSettings['RADIUS'] = spot_diameter / 2 # type = double
settings.detectorSettings['TARGET_CHANNEL'] = 0 settings.detectorSettings['TARGET_CHANNEL'] = 0
settings.detectorSettings['THRESHOLD'] = quality_threshold # type = double settings.detectorSettings['THRESHOLD'] = quality_threshold # type = double
settings.detectorSettings['DO_MEDIAN_FILTERING'] = False settings.detectorSettings['DO_MEDIAN_FILTERING'] = False
...@@ -758,18 +758,16 @@ processing_channels = processing_channels_string.split(",") ...@@ -758,18 +758,16 @@ processing_channels = processing_channels_string.split(",")
quality_thresholds_string = quality_thresholds_string.replace(" ", "") quality_thresholds_string = quality_thresholds_string.replace(" ", "")
quality_thresholds = quality_thresholds_string.split(",") quality_thresholds = quality_thresholds_string.split(",")
# Get the fiber segmentation from ij roizip and convert to labelimage
canvas = create_empty_image(32, image_width, image_height)
load_rois_from_zip(fiber_segmentation_roiset)
fibers_label_imp = convert_rois_to_labelimage(canvas)
canvas.close()
# threshold DAPI channel and convert to binary # threshold DAPI channel and convert to binary
dapi_channel = BFopen_image(path_to_image, dapi_channel_number, series_number) dapi_channel = BFopen_image(path_to_image, dapi_channel_number, series_number)
if threshold <= 0: if threshold <= 0:
threshold = get_threshold_from_method(dapi_channel, "otsu") threshold = get_threshold_from_method(dapi_channel, "otsu")
dapi_binary = convert_to_binary(dapi_channel, threshold) dapi_binary = convert_to_binary(dapi_channel, threshold)
close_images([dapi_channel])
# Get the fiber segmentation from ij roizip and convert to labelimage
load_rois_from_zip(fiber_segmentation_roiset)
fibers_label_imp = convert_rois_to_labelimage(dapi_channel)
dapi_channel.close()
# detect spots and count them per fiber # detect spots and count them per fiber
results_table = ResultsTable() results_table = ResultsTable()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment