-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR addresses issue #116 and adds a new widget (Projection - 2 channel projection with reference channel) to perform projection of 2-channel images where one channel is the reference for the surface of interest. This will typically be a "clean" surface marker eg Decad for the apical surface and the second channel will be projected based on that. The new widget works as expected however I will need a bit of help in addressing some pre-commit checks. Closes #116 --------- Co-authored-by: Pablo Vicente Munuera <pablovm1990@gmail.com>
- Loading branch information
1 parent
5a43a81
commit 5eebef3
Showing
10 changed files
with
225 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from epitools.widgets import dialogue | ||
from epitools.widgets.cell_statistics import create_cell_statistics_widget | ||
from epitools.widgets.projection import create_projection_widget | ||
from epitools.widgets.projection_2ch import create_projection_2ch_widget | ||
from epitools.widgets.segmentation import create_segmentation_widget | ||
|
||
__all__ = [ | ||
"dialogue", | ||
"create_cell_statistics_widget", | ||
"create_projection_widget", | ||
"create_projection_2ch_widget", | ||
"create_segmentation_widget", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import magicgui.widgets | ||
import napari | ||
|
||
__all__ = [ | ||
"create_projection_2ch_widget", | ||
] | ||
|
||
|
||
def create_projection_2ch_widget() -> magicgui.widgets.Container: | ||
"""Create a widget for projecting a 2 channel, 3d timeseries to a | ||
2d timeseries based on a reference channel""" | ||
|
||
refchannel_tooltip = ( | ||
"Select a 'Reference' channel to project along the z-dimension." | ||
) | ||
refchannel = magicgui.widgets.create_widget( | ||
annotation=napari.layers.Image, | ||
name="refchannel", | ||
label="reference channel", | ||
options={"tooltip": refchannel_tooltip}, | ||
) | ||
|
||
channel_tooltip = "Select a second channel to project along the \ | ||
z-dimension based on the 'Reference'." | ||
channel = magicgui.widgets.create_widget( | ||
annotation=napari.layers.Image, | ||
name="channel", | ||
label="second channel", | ||
options={"tooltip": channel_tooltip}, | ||
) | ||
|
||
smoothing_radius_tooltip = ( | ||
"Kernel radius for gaussian blur to apply before estimating the surface." | ||
) | ||
smoothing_radius = magicgui.widgets.create_widget( | ||
value=1, | ||
name="smoothing_radius", | ||
label="smoothing radius", | ||
widget_type="FloatSpinBox", | ||
options={ | ||
"tooltip": smoothing_radius_tooltip, | ||
}, | ||
) | ||
|
||
surface_smoothness_1_tooltip = ( | ||
"Surface smoothness for 1st griddata estimation, larger means smoother." | ||
) | ||
surface_smoothness_1 = magicgui.widgets.create_widget( | ||
value=5, | ||
name="surface_smoothness_1", | ||
label="surface smoothness 1", | ||
widget_type="SpinBox", | ||
options={ | ||
"tooltip": surface_smoothness_1_tooltip, | ||
}, | ||
) | ||
|
||
surface_smoothness_2_tooltip = ( | ||
"Surface smoothness for 2nd griddata estimation, larger means smoother." | ||
) | ||
surface_smoothness_2 = magicgui.widgets.create_widget( | ||
value=5, | ||
name="surface_smoothness_2", | ||
label="surface smoothness 2", | ||
widget_type="SpinBox", | ||
options={ | ||
"tooltip": surface_smoothness_2_tooltip, | ||
}, | ||
) | ||
|
||
cutoff_distance_tooltip = ( | ||
"Cutoff distance in z-planes from the 1st estimated surface." | ||
) | ||
cutoff_distance = magicgui.widgets.create_widget( | ||
value=3, | ||
name="cutoff_distance", | ||
label="z cutoff distance", | ||
widget_type="SpinBox", | ||
options={ | ||
"tooltip": cutoff_distance_tooltip, | ||
}, | ||
) | ||
|
||
run_button_tooltip = "Perform the projection" | ||
run_button = magicgui.widgets.create_widget( | ||
name="run", | ||
label="Run", | ||
widget_type="PushButton", | ||
options={"tooltip": run_button_tooltip}, | ||
) | ||
|
||
return magicgui.widgets.Container( | ||
widgets=[ | ||
refchannel, | ||
channel, | ||
smoothing_radius, | ||
surface_smoothness_1, | ||
surface_smoothness_2, | ||
cutoff_distance, | ||
run_button, | ||
], | ||
scrollable=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.