celldetective 1.3.2__py3-none-any.whl → 1.3.3.post1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- celldetective/_version.py +1 -1
- celldetective/gui/control_panel.py +2 -2
- celldetective/gui/measurement_options.py +35 -32
- celldetective/gui/process_block.py +5 -94
- celldetective/gui/retrain_segmentation_model_options.py +3 -1
- celldetective/gui/thresholds_gui.py +195 -199
- celldetective/gui/viewers.py +267 -13
- celldetective/io.py +54 -7
- celldetective/measure.py +125 -88
- celldetective/models/segmentation_effectors/ricm_bf_all_last/config_input.json +79 -0
- celldetective/models/segmentation_effectors/ricm_bf_all_last/ricm_bf_all_last +0 -0
- celldetective/models/segmentation_effectors/ricm_bf_all_last/training_instructions.json +37 -0
- celldetective/models/segmentation_effectors/test-transfer/config_input.json +39 -0
- celldetective/models/segmentation_effectors/test-transfer/test-transfer +0 -0
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/METADATA +11 -10
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/RECORD +20 -15
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/WHEEL +1 -1
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/LICENSE +0 -0
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/entry_points.txt +0 -0
- {celldetective-1.3.2.dist-info → celldetective-1.3.3.post1.dist-info}/top_level.txt +0 -0
celldetective/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.3.
|
|
1
|
+
__version__ = "1.3.3.post1"
|
|
@@ -450,8 +450,8 @@ class ControlPanel(QMainWindow, Styles):
|
|
|
450
450
|
self.view_stack_btn.setEnabled(False)
|
|
451
451
|
self.ProcessEffectors.signal_analysis_action.setEnabled(True)
|
|
452
452
|
self.ProcessTargets.signal_analysis_action.setEnabled(True)
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
if hasattr(self,'delete_tracks_btn'):
|
|
454
|
+
self.delete_tracks_btn.hide()
|
|
455
455
|
self.ProcessTargets.delete_tracks_btn.hide()
|
|
456
456
|
self.ProcessEffectors.delete_tracks_btn.hide()
|
|
457
457
|
else:
|
|
@@ -10,7 +10,7 @@ from superqt import QLabeledDoubleSlider
|
|
|
10
10
|
from superqt.fonticon import icon
|
|
11
11
|
from fonticon_mdi6 import MDI6
|
|
12
12
|
|
|
13
|
-
from celldetective.gui.thresholds_gui import ThresholdSpot
|
|
13
|
+
#from celldetective.gui.thresholds_gui import ThresholdSpot
|
|
14
14
|
from celldetective.utils import extract_experiment_channels, get_software_location
|
|
15
15
|
from celldetective.io import load_frames, auto_load_number_of_frames
|
|
16
16
|
from celldetective.measure import compute_haralick_features
|
|
@@ -26,7 +26,7 @@ from tifffile import imread
|
|
|
26
26
|
from pathlib import Path
|
|
27
27
|
import gc
|
|
28
28
|
|
|
29
|
-
from celldetective.gui.viewers import CellEdgeVisualizer
|
|
29
|
+
from celldetective.gui.viewers import CellEdgeVisualizer, SpotDetectionVisualizer
|
|
30
30
|
from celldetective.gui.layouts import ProtocolDesignerLayout, BackgroundFitCorrectionLayout, LocalCorrectionLayout
|
|
31
31
|
from celldetective.gui.gui_utils import ThresholdLineEdit
|
|
32
32
|
from celldetective.gui import Styles
|
|
@@ -951,51 +951,54 @@ class ConfigMeasurements(QMainWindow, Styles):
|
|
|
951
951
|
|
|
952
952
|
layout.addWidget(self.threshold_lbl, 4, 0)
|
|
953
953
|
layout.addWidget(self.threshold_value, 4, 1)
|
|
954
|
-
self.preview_spot = QPushButton('Preview')
|
|
955
|
-
self.preview_spot.clicked.connect(self.spot_preview)
|
|
956
|
-
self.preview_spot.setStyleSheet(self.button_style_sheet_2)
|
|
957
|
-
layout.addWidget(self.preview_spot, 5, 0, 1, 2)
|
|
958
|
-
self.spot_channel.setEnabled(False)
|
|
959
|
-
self.spot_channel_lbl.setEnabled(False)
|
|
960
|
-
self.diameter_value.setEnabled(False)
|
|
961
|
-
self.diameter_lbl.setEnabled(False)
|
|
962
|
-
self.threshold_value.setEnabled(False)
|
|
963
|
-
self.threshold_lbl.setEnabled(False)
|
|
964
|
-
self.preview_spot.setEnabled(False)
|
|
965
954
|
|
|
955
|
+
self.spot_viewer_btn = QPushButton()
|
|
956
|
+
self.spot_viewer_btn.clicked.connect(self.spot_preview)
|
|
957
|
+
self.spot_viewer_btn.setIcon(icon(MDI6.image_check, color="k"))
|
|
958
|
+
self.spot_viewer_btn.setStyleSheet(self.button_select_all)
|
|
959
|
+
self.spot_viewer_btn.setToolTip('Set detection parameters visually.')
|
|
960
|
+
layout.addWidget(self.spot_viewer_btn, 1, 1, 1, 1, alignment=Qt.AlignRight)
|
|
961
|
+
|
|
962
|
+
self.spot_detection_widgets = [self.spot_channel, self.spot_channel_lbl, self.diameter_value, self.diameter_lbl, self.threshold_value, self.threshold_lbl, self.spot_viewer_btn]
|
|
963
|
+
for wg in self.spot_detection_widgets:
|
|
964
|
+
wg.setEnabled(False)
|
|
966
965
|
|
|
967
966
|
def enable_spot_preview(self):
|
|
968
967
|
|
|
969
968
|
diam = self.diameter_value.text().replace(',','').replace('.','')
|
|
970
969
|
thresh = self.threshold_value.text().replace(',','').replace('.','')
|
|
971
970
|
if diam.isnumeric() and thresh.isnumeric():
|
|
972
|
-
self.
|
|
971
|
+
self.spot_viewer_btn.setEnabled(True)
|
|
973
972
|
else:
|
|
974
|
-
self.
|
|
973
|
+
self.spot_viewer_btn.setEnabled(False)
|
|
975
974
|
|
|
976
975
|
def spot_preview(self):
|
|
977
976
|
self.locate_image()
|
|
978
977
|
if self.test_frame is not None:
|
|
979
978
|
self.locate_mask()
|
|
980
979
|
if self.test_mask is not None:
|
|
981
|
-
self.spot_visual =
|
|
982
|
-
|
|
980
|
+
self.spot_visual = SpotDetectionVisualizer(frame_slider=True,
|
|
981
|
+
contrast_slider=True,
|
|
982
|
+
cell_type=self.mode,
|
|
983
|
+
channel_cb=True,
|
|
984
|
+
channel_names = self.channel_names,
|
|
985
|
+
stack_path=self.current_stack,
|
|
986
|
+
n_channels=len(self.channel_names),
|
|
987
|
+
target_channel=self.spot_channel.currentIndex(),
|
|
988
|
+
window_title='Detect spots',
|
|
989
|
+
parent_channel_cb=self.spot_channel,
|
|
990
|
+
parent_diameter_le=self.diameter_value,
|
|
991
|
+
parent_threshold_le=self.threshold_value,
|
|
992
|
+
PxToUm = 1,)
|
|
993
|
+
self.spot_visual.show()
|
|
994
|
+
#self.spot_visual = ThresholdSpot(current_channel=self.spot_channel.currentIndex(), img=self.test_frame,
|
|
995
|
+
# mask=self.test_mask, parent_window=self)
|
|
983
996
|
|
|
984
997
|
def enable_spot_detection(self):
|
|
985
|
-
if self.spot_check.isChecked():
|
|
986
|
-
self.spot_channel.setEnabled(True)
|
|
987
|
-
self.spot_channel_lbl.setEnabled(True)
|
|
988
|
-
self.diameter_value.setEnabled(True)
|
|
989
|
-
self.diameter_lbl.setEnabled(True)
|
|
990
|
-
self.threshold_value.setEnabled(True)
|
|
991
|
-
self.threshold_lbl.setEnabled(True)
|
|
992
|
-
self.preview_spot.setEnabled(True)
|
|
993
998
|
|
|
999
|
+
if self.spot_check.isChecked():
|
|
1000
|
+
for wg in self.spot_detection_widgets:
|
|
1001
|
+
wg.setEnabled(True)
|
|
994
1002
|
else:
|
|
995
|
-
self.
|
|
996
|
-
|
|
997
|
-
self.diameter_value.setEnabled(False)
|
|
998
|
-
self.diameter_lbl.setEnabled(False)
|
|
999
|
-
self.threshold_value.setEnabled(False)
|
|
1000
|
-
self.threshold_lbl.setEnabled(False)
|
|
1001
|
-
self.preview_spot.setEnabled(False)
|
|
1003
|
+
for wg in self.spot_detection_widgets:
|
|
1004
|
+
wg.setEnabled(False)
|
|
@@ -291,6 +291,7 @@ class ProcessPanel(QFrame, Styles):
|
|
|
291
291
|
self.signal_models_list.addItems(signal_models)
|
|
292
292
|
|
|
293
293
|
def generate_tracking_options(self):
|
|
294
|
+
|
|
294
295
|
grid_track = QHBoxLayout()
|
|
295
296
|
|
|
296
297
|
self.track_action = QCheckBox("TRACK")
|
|
@@ -303,16 +304,6 @@ class ProcessPanel(QFrame, Styles):
|
|
|
303
304
|
padding-top: 5px;
|
|
304
305
|
""")
|
|
305
306
|
grid_track.addWidget(self.track_action, 75)
|
|
306
|
-
#self.to_disable.append(self.track_action_tc)
|
|
307
|
-
|
|
308
|
-
# self.show_track_table_btn = QPushButton()
|
|
309
|
-
# self.show_track_table_btn.setIcon(icon(MDI6.table,color="black"))
|
|
310
|
-
# self.show_track_table_btn.setIconSize(QSize(20, 20))
|
|
311
|
-
# self.show_track_table_btn.setToolTip("Show trajectories table.")
|
|
312
|
-
# self.show_track_table_btn.setStyleSheet(self.button_select_all)
|
|
313
|
-
# #self.show_track_table_btn.clicked.connect(self.display_trajectory_table)
|
|
314
|
-
# self.show_track_table_btn.setEnabled(False)
|
|
315
|
-
# grid_track.addWidget(self.show_track_table_btn, 6) #4,3,1,1, alignment=Qt.AlignLeft
|
|
316
307
|
|
|
317
308
|
self.delete_tracks_btn = QPushButton()
|
|
318
309
|
self.delete_tracks_btn.setIcon(icon(MDI6.trash_can,color="black"))
|
|
@@ -640,25 +631,6 @@ class ProcessPanel(QFrame, Styles):
|
|
|
640
631
|
|
|
641
632
|
self.seg_model_list.insertSeparator(len(self.models_truncated))
|
|
642
633
|
|
|
643
|
-
|
|
644
|
-
#if ("live_nuclei_channel" in self.exp_channels)*("dead_nuclei_channel" in self.exp_channels):
|
|
645
|
-
# print("both channels found")
|
|
646
|
-
# index = self.tc_seg_model_list.findText("MCF7_Hoescht_PI_w_primary_NK", Qt.MatchFixedString)
|
|
647
|
-
# if index >= 0:
|
|
648
|
-
# self.tc_seg_model_list.setCurrentIndex(index)
|
|
649
|
-
# elif ("live_nuclei_channel" in self.exp_channels)*("dead_nuclei_channel" not in self.exp_channels):
|
|
650
|
-
# index = self.tc_seg_model_list.findText("MCF7_Hoescht_w_primary_NK", Qt.MatchFixedString)
|
|
651
|
-
# if index >= 0:
|
|
652
|
-
# self.tc_seg_model_list.setCurrentIndex(index)
|
|
653
|
-
# elif ("live_nuclei_channel" not in self.exp_channels)*("dead_nuclei_channel" in self.exp_channels):
|
|
654
|
-
# index = self.tc_seg_model_list.findText("MCF7_PI_w_primary_NK", Qt.MatchFixedString)
|
|
655
|
-
# if index >= 0:
|
|
656
|
-
# self.tc_seg_model_list.setCurrentIndex(index)
|
|
657
|
-
# elif ("live_nuclei_channel" not in self.exp_channels)*("dead_nuclei_channel" not in self.exp_channels)*("adhesion_channel" in self.exp_channels):
|
|
658
|
-
# index = self.tc_seg_model_list.findText("RICM", Qt.MatchFixedString)
|
|
659
|
-
# if index >= 0:
|
|
660
|
-
# self.tc_seg_model_list.setCurrentIndex(index)
|
|
661
|
-
|
|
662
634
|
def tick_all_actions(self):
|
|
663
635
|
self.switch_all_ticks_option()
|
|
664
636
|
if self.all_ticked:
|
|
@@ -884,28 +856,7 @@ class ProcessPanel(QFrame, Styles):
|
|
|
884
856
|
if self.segment_action.isChecked():
|
|
885
857
|
self.segment_action.setChecked(False)
|
|
886
858
|
|
|
887
|
-
|
|
888
|
-
# self.unfreeze()
|
|
889
|
-
|
|
890
|
-
# def view_current_stack_with_scale_bar(self):
|
|
891
|
-
|
|
892
|
-
# self.parent_window.locate_image()
|
|
893
|
-
# if self.parent_window.current_stack is not None:
|
|
894
|
-
# self.viewer = CellSizeViewer(
|
|
895
|
-
# initial_diameter = float(self.diameter_le.text().replace(',', '.')),
|
|
896
|
-
# parent_le = self.diameter_le,
|
|
897
|
-
# stack_path=self.parent_window.current_stack,
|
|
898
|
-
# window_title=f'Position {self.parent_window.position_list.currentText()}',
|
|
899
|
-
# frame_slider = True,
|
|
900
|
-
# contrast_slider = True,
|
|
901
|
-
# channel_cb = True,
|
|
902
|
-
# channel_names = self.parent_window.exp_channels,
|
|
903
|
-
# n_channels = self.parent_window.nbr_channels,
|
|
904
|
-
# PxToUm = 1,
|
|
905
|
-
# )
|
|
906
|
-
# self.viewer.show()
|
|
907
|
-
|
|
908
|
-
|
|
859
|
+
self.cellpose_calibrated = False
|
|
909
860
|
|
|
910
861
|
def open_napari_tracking(self):
|
|
911
862
|
print(f'View the tracks before post-processing for position {self.parent_window.pos} in napari...')
|
|
@@ -933,24 +884,6 @@ class ProcessPanel(QFrame, Styles):
|
|
|
933
884
|
if returnValue == QMessageBox.Ok:
|
|
934
885
|
return None
|
|
935
886
|
|
|
936
|
-
# def interpret_pos_location(self):
|
|
937
|
-
|
|
938
|
-
# """
|
|
939
|
-
# Read the well/position selection from the control panel to decide which data to load
|
|
940
|
-
# Set position_indices to None if all positions must be taken
|
|
941
|
-
|
|
942
|
-
# """
|
|
943
|
-
|
|
944
|
-
# if self.well_option==len(self.wells):
|
|
945
|
-
# self.well_indices = np.arange(len(self.wells))
|
|
946
|
-
# else:
|
|
947
|
-
# self.well_indices = np.array([self.well_option],dtype=int)
|
|
948
|
-
|
|
949
|
-
# if self.position_option==0:
|
|
950
|
-
# self.position_indices = None
|
|
951
|
-
# else:
|
|
952
|
-
# self.position_indices = np.array([self.position_option],dtype=int)
|
|
953
|
-
|
|
954
887
|
def load_available_tables(self):
|
|
955
888
|
|
|
956
889
|
"""
|
|
@@ -1016,6 +949,7 @@ class ProcessPanel(QFrame, Styles):
|
|
|
1016
949
|
self.process_population()
|
|
1017
950
|
|
|
1018
951
|
|
|
952
|
+
|
|
1019
953
|
class NeighPanel(QFrame, Styles):
|
|
1020
954
|
def __init__(self, parent_window):
|
|
1021
955
|
|
|
@@ -1523,35 +1457,12 @@ class NeighPanel(QFrame, Styles):
|
|
|
1523
1457
|
rel_measure_at_position(self.pos)
|
|
1524
1458
|
|
|
1525
1459
|
if self.signal_analysis_action.isChecked():
|
|
1526
|
-
|
|
1527
|
-
# df_targets = get_position_pickle(self.pos, population='targets')
|
|
1528
|
-
# df_effectors = get_position_pickle(self.pos, population='effectors')
|
|
1529
|
-
# self.dataframes = {
|
|
1530
|
-
# 'targets': df_targets,
|
|
1531
|
-
# 'effectors': df_effectors,
|
|
1532
|
-
# }
|
|
1533
|
-
|
|
1534
|
-
# df_pairs = get_position_table(self.pos, population='pairs')
|
|
1535
|
-
|
|
1536
|
-
# # Need to identify expected reference / neighbor tables
|
|
1537
|
-
# model_path = locate_signal_model(self.pair_signal_models_list.currentText(), pairs=True)
|
|
1538
|
-
# print(f'Looking for model in {model_path}...')
|
|
1539
|
-
# complete_path = model_path
|
|
1540
|
-
# complete_path = rf"{complete_path}"
|
|
1541
|
-
# model_config_path = os.sep.join([complete_path, 'config_input.json'])
|
|
1542
|
-
# model_config_path = rf"{model_config_path}"
|
|
1543
|
-
# f = open(model_config_path)
|
|
1544
|
-
# model_config_path = json.load(f)
|
|
1545
|
-
|
|
1546
|
-
# reference_population = model_config_path['reference_population']
|
|
1547
|
-
# neighbor_population = model_config_path['neighbor_population']
|
|
1548
|
-
|
|
1549
|
-
# analyze_pair_signals(df_pairs, self.dataframes[reference_population], self.dataframes[neighbor_population], model=self.pair_signal_models_list.currentText())
|
|
1460
|
+
|
|
1550
1461
|
analyze_pair_signals_at_position(self.pos, self.pair_signal_models_list.currentText(), use_gpu=self.parent_window.parent_window.use_gpu)
|
|
1462
|
+
|
|
1551
1463
|
self.parent_window.update_position_options()
|
|
1552
1464
|
print('Done.')
|
|
1553
1465
|
|
|
1554
|
-
|
|
1555
1466
|
def check_signals2(self):
|
|
1556
1467
|
|
|
1557
1468
|
test = self.parent_window.locate_selected_position()
|
|
@@ -616,4 +616,6 @@ class ConfigSegmentationModelTraining(QMainWindow, Styles):
|
|
|
616
616
|
|
|
617
617
|
train_segmentation_model(model_folder+"training_instructions.json", use_gpu=self.parent_window.parent_window.parent_window.use_gpu)
|
|
618
618
|
|
|
619
|
-
|
|
619
|
+
self.parent_window.init_seg_model_list()
|
|
620
|
+
idx = self.parent_window.seg_model_list.findText(model_name)
|
|
621
|
+
self.parent_window.seg_model_list.setCurrentIndex(idx)
|