Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import xmltodict
from bigfish import stack
from cut_detector.utils.parameters import Parameters
from munch import Munch
from cnn_framework.utils.tools import save_tiff

Expand Down Expand Up @@ -29,7 +30,8 @@ def extract_bridge_images(
save_dir : str
Path to the folder where to save the images.
"""
margin = MtCutDetectionFactory().margin
params = Parameters()
margin = MtCutDetectionFactory(params).margin

# Create save_dir if not exists
if not os.path.exists(save_dir):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cnn_framework.utils.readers.tiff_reader import TiffReader


from cut_detector.utils.parameters import Parameters
from developers.ground_truth_generation.bridges.semi_images_generation.micro_tubules_augmentations_advanced import (
MicroTubulesAugmentationAdvanced,
)
Expand All @@ -22,7 +23,8 @@

def main(params, save_dir, debug_plot, circle_radius=11, diff_radius=4.54):

factory = MtCutDetectionFactoryAdvanced()
params = Parameters()
factory = MtCutDetectionFactoryAdvanced(params)
file_paths = os.listdir(params.data_dir)

# Create the save directory if it does not exist
Expand Down
2 changes: 2 additions & 0 deletions playground/mid_body_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from cnn_framework.utils.readers.tiff_reader import TiffReader

from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.utils.tools import re_organize_channels
from cut_detector.widget_functions.mid_body_detection import (
perform_mid_body_detection,
Expand Down Expand Up @@ -48,6 +49,7 @@ def main(
video_name,
mitoses_path,
tracks_path,
Parameters(),
save=save,
movies_save_dir=movies_save_dir,
)
Expand Down
3 changes: 2 additions & 1 deletion playground/mitosis_track_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from cut_detector.utils.cell_spot import CellSpot
from cut_detector.utils.cell_track import CellTrack
from cut_detector.utils.mitosis_track import MitosisTrack
from cut_detector.utils.parameters import Parameters
from cut_detector.utils.tools import re_organize_channels
from cut_detector.widget_functions.mitosis_track_generation import (
perform_mitosis_track_generation,
Expand Down Expand Up @@ -155,7 +156,7 @@ def main(
image = re_organize_channels(image.squeeze()) # TYXC

mitosis_tracks, cell_spots, cell_tracks = perform_mitosis_track_generation(
image, video_name, spots_dir, tracks_dir
image, video_name, spots_dir, tracks_dir, Parameters()
)

plot_predictions_evolution(cell_spots, cell_tracks, mitosis_tracks)
Expand Down
4 changes: 3 additions & 1 deletion playground/mt_cut_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
MtCutDetectionFactory,
)
from cut_detector.utils.mitosis_track import MitosisTrack
from cut_detector.utils.parameters import Parameters
from cut_detector.utils.tools import re_organize_channels


Expand Down Expand Up @@ -57,7 +58,8 @@ def main(

image = re_organize_channels(image.squeeze()) # TYXC

factory = MtCutDetectionFactory()
params = Parameters()
factory = MtCutDetectionFactory(params)

results = factory.update_mt_cut_detection(
[mitosis_track],
Expand Down
4 changes: 3 additions & 1 deletion playground/napari_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from cut_detector.factories.results_saving_factory import ResultsSavingFactory
from cut_detector.utils.cell_track import CellTrack
from cut_detector.utils.mitosis_track import MitosisTrack
from cut_detector.utils.parameters import Parameters


def main(
Expand Down Expand Up @@ -60,7 +61,8 @@ def main(
mitosis_track = MitosisTrack.load(f)
mitosis_tracks.append(mitosis_track)

ResultsSavingFactory().generate_napari_tracking_mask(
params = Parameters()
ResultsSavingFactory(params).generate_napari_tracking_mask(
mitosis_tracks,
video,
viewer,
Expand Down
2 changes: 2 additions & 0 deletions playground/results_saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cnn_framework.utils.readers.tiff_reader import TiffReader

from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.utils.tools import re_organize_channels
from cut_detector.widget_functions.save_results import perform_results_saving

Expand Down Expand Up @@ -33,6 +34,7 @@ def main(

perform_results_saving(
mitosis_path,
Parameters(),
show=False,
save_dir=results_dir,
verbose=True,
Expand Down
2 changes: 2 additions & 0 deletions src/cut_detector/_tests/test_micro_tubules_cut_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from cut_detector._widget import micro_tubules_cut_detection
from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.widget_functions.mt_cut_detection import (
perform_mt_cut_detection,
)
Expand All @@ -25,6 +26,7 @@ def test_micro_tubules_cut_detection():
video,
"example_video",
get_data_path("mitoses"),
Parameters(),
save=False,
)

Expand Down
4 changes: 4 additions & 0 deletions src/cut_detector/_tests/test_mid_body_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from cut_detector._widget import mid_body_detection
from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.widget_functions.mid_body_detection import (
perform_mid_body_detection,
)
Expand All @@ -29,6 +30,7 @@ def test_mid_body_detection():
"example_video",
get_data_path("mitoses"),
get_data_path("tracks"),
params=Parameters(),
save=False,
parallel_detection=True,
)
Expand All @@ -44,6 +46,7 @@ def test_mid_body_detection():
"example_video",
get_data_path("mitoses"),
get_data_path("tracks"),
params=Parameters(),
save=False,
parallel_detection=False,
)
Expand All @@ -52,6 +55,7 @@ def test_mid_body_detection():
"example_video",
get_data_path("mitoses"),
get_data_path("tracks"),
params=Parameters(),
save=False,
parallel_detection=False,
detection_method="h_maxima",
Expand Down
2 changes: 2 additions & 0 deletions src/cut_detector/_tests/test_results_saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from cut_detector._widget import results_saving
from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.widget_functions.save_results import perform_results_saving

import pytest
Expand All @@ -23,6 +24,7 @@ def test_results_saving():

perform_results_saving(
get_data_path("mitoses"),
Parameters(),
show=False,
save_dir=get_data_path("results"),
verbose=True,
Expand Down
2 changes: 2 additions & 0 deletions src/cut_detector/_tests/test_track_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from cut_detector._widget import mitosis_track_generation
from cut_detector.data.tools import get_data_path
from cut_detector.utils.parameters import Parameters
from cut_detector.widget_functions.mitosis_track_generation import (
perform_mitosis_track_generation,
)
Expand All @@ -27,6 +28,7 @@ def test_track_generation():
"example_video",
get_data_path("spots"),
get_data_path("tracks"),
Parameters(),
save=False,
)

Expand Down
Loading
Loading