labdata 0.1.3__tar.gz → 0.1.4__tar.gz
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.
- {labdata-0.1.3 → labdata-0.1.4}/PKG-INFO +1 -1
- {labdata-0.1.3 → labdata-0.1.4}/labdata/__init__.py +1 -1
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/segmentation.py +66 -51
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/PKG-INFO +1 -1
- {labdata-0.1.3 → labdata-0.1.4}/LICENSE +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/README.md +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/cli.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/__init__.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/caiman.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/ec2.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/ephys.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/pose.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/schedulers.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/singularity.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/suite2p.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/compute/utils.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/copy.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/__init__.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/compute.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/console.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/decisiontask.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/explorer/__init__.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/explorer/cellsegmentation.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/explorer/spikesorting.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/index.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/notes.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/procedures.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/sorting.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/dashboard/video.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/export.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/rules/__init__.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/rules/ephys.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/rules/imaging.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/rules/utils.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/s3.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/__init__.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/ephys.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/general.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/histology.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/onephoton.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/procedures.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/tasks.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/twophoton.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/utils.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/schema/video.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/stacks.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/utils.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata/widgets.py +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/SOURCES.txt +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/dependency_links.txt +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/entry_points.txt +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/requires.txt +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/labdata.egg-info/top_level.txt +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/pyproject.toml +0 -0
- {labdata-0.1.3 → labdata-0.1.4}/setup.cfg +0 -0
|
@@ -83,7 +83,7 @@ def segmentation_tab(schema=None):
|
|
|
83
83
|
|
|
84
84
|
@st.cache_data
|
|
85
85
|
def get_roi_color_proj(subject_name, session_name, dataset_name, parameter_set_num,
|
|
86
|
-
sel_method,
|
|
86
|
+
sel_method, sel_label):
|
|
87
87
|
from labdata.stacks import roi_color_projection
|
|
88
88
|
key = dict(subject_name=subject_name, session_name=session_name,
|
|
89
89
|
dataset_name=dataset_name, parameter_set_num=parameter_set_num)
|
|
@@ -99,10 +99,10 @@ def segmentation_tab(schema=None):
|
|
|
99
99
|
roi_nums = list(roi_table.fetch('roi_num'))
|
|
100
100
|
if not roi_nums:
|
|
101
101
|
continue
|
|
102
|
-
if
|
|
102
|
+
if sel_label is not None:
|
|
103
103
|
sel_rois = set(
|
|
104
104
|
(schema.CellSegmentation.Selection
|
|
105
|
-
& dict(plane_key, selection_method=sel_method, selection=
|
|
105
|
+
& dict(plane_key, selection_method=sel_method, selection=sel_label)
|
|
106
106
|
).fetch('roi_num'))
|
|
107
107
|
cell_indices = [i for i, rn in enumerate(roi_nums) if rn in sel_rois]
|
|
108
108
|
else:
|
|
@@ -526,7 +526,7 @@ def segmentation_tab(schema=None):
|
|
|
526
526
|
with st.spinner('Loading ROI color projection…'):
|
|
527
527
|
roi_color_projs = get_roi_color_proj(
|
|
528
528
|
subject, row['session_name'], row['dataset_name'], param_set, sel_method,
|
|
529
|
-
|
|
529
|
+
sel_label=None if sel_label_filter == 'All' else int(sel_label_filter))
|
|
530
530
|
|
|
531
531
|
all_projections = roi_color_projs + list(projections)
|
|
532
532
|
|
|
@@ -758,60 +758,77 @@ def segmentation_tab(schema=None):
|
|
|
758
758
|
frame_rate, _ = get_frame_rate(subject, row['session_name'], row['dataset_name'])
|
|
759
759
|
traces_df = traces_df.copy()
|
|
760
760
|
traces_df['t_sec'] = traces_df['t'] / frame_rate
|
|
761
|
-
|
|
762
761
|
y_min = min(0.0, float(traces_df['value'].min()))
|
|
763
762
|
y_max = float(traces_df['value'].max())
|
|
764
|
-
|
|
765
763
|
window_s = 300.0
|
|
766
764
|
total_s = float(traces_df['t_sec'].max())
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
765
|
+
|
|
766
|
+
def _draw_traces():
|
|
767
|
+
if total_s > window_s:
|
|
768
|
+
max_start = round(total_s - window_s, 2)
|
|
769
|
+
_lc, _tb, _sc, _tf = st.columns([1, 0.2, 10, 0.2])
|
|
770
|
+
_lc.markdown('**Time (s)**')
|
|
771
|
+
if _tb.button('-', key='seg_time_back', use_container_width=True):
|
|
772
|
+
cur = st.session_state.get('seg_trace_window', 0.0)
|
|
773
|
+
st.session_state['seg_trace_window'] = max(0.0, cur - window_s/2)
|
|
774
|
+
_rerun()
|
|
775
|
+
if _tf.button('+', key='seg_time_fwd', use_container_width=True):
|
|
776
|
+
cur = st.session_state.get('seg_trace_window', 0.0)
|
|
777
|
+
st.session_state['seg_trace_window'] = min(max_start, cur + window_s/2)
|
|
778
|
+
_rerun()
|
|
779
|
+
t_start = _sc.slider('Time (s)', 0.0, max_start,
|
|
780
|
+
st.session_state.get('seg_trace_window', 0.0),
|
|
781
|
+
step=30.0, key='seg_trace_window',
|
|
782
|
+
label_visibility='collapsed')
|
|
783
|
+
else:
|
|
784
|
+
t_start = 0.0
|
|
785
|
+
t_end = t_start + window_s
|
|
786
|
+
view_df = traces_df[
|
|
787
|
+
(traces_df['t_sec'] >= t_start) & (traces_df['t_sec'] <= t_end)]
|
|
788
|
+
trace_chart = (
|
|
789
|
+
alt.Chart(view_df)
|
|
790
|
+
.mark_line(strokeWidth=1.2)
|
|
791
|
+
.encode(
|
|
792
|
+
x=alt.X('t_sec:Q', title='Time (s)',
|
|
793
|
+
scale=alt.Scale(domain=[t_start, t_end]),
|
|
794
|
+
axis=alt.Axis(tickCount=5, tickSize=5, grid=False)),
|
|
795
|
+
y=alt.Y('value:Q', title=trace_type,
|
|
796
|
+
scale=alt.Scale(domain=[y_min-0.1, y_max+0.1]),
|
|
797
|
+
axis=alt.Axis(tickCount=5, tickSize=5, grid=False)),
|
|
798
|
+
color=alt.Color('roi:N', title='ROI',
|
|
799
|
+
scale=alt.Scale(domain=roi_labels,
|
|
800
|
+
range=roi_color_range)),
|
|
801
|
+
tooltip=['roi:N',
|
|
802
|
+
alt.Tooltip('t_sec:Q', title='Time (s)', format='.2f'),
|
|
803
|
+
alt.Tooltip('value:Q', format='.4f')],
|
|
804
|
+
)
|
|
805
|
+
.properties(height=220).interactive()
|
|
803
806
|
)
|
|
804
|
-
.
|
|
805
|
-
|
|
806
|
-
st
|
|
807
|
+
st.altair_chart(trace_chart, width='stretch')
|
|
808
|
+
|
|
809
|
+
if hasattr(st, 'fragment'):
|
|
810
|
+
def _rerun(): st.rerun(scope='fragment')
|
|
811
|
+
st.fragment(_draw_traces)()
|
|
812
|
+
else:
|
|
813
|
+
def _rerun(): st.rerun()
|
|
814
|
+
_draw_traces()
|
|
807
815
|
|
|
808
816
|
# classification editor — shows currently picked cells and cells whose
|
|
809
817
|
# classification was changed from the original value
|
|
810
818
|
st.write('**ROI classification**')
|
|
819
|
+
|
|
820
|
+
# avoid second re-run
|
|
821
|
+
if st.session_state.pop('_seg_propagate_pending', False):
|
|
822
|
+
pv = st.session_state.pop('_seg_propagate_val', None)
|
|
823
|
+
if pv is not None:
|
|
824
|
+
st.session_state['seg_editor_rows'] = [
|
|
825
|
+
dict(r, selection=pv) for r in st.session_state['seg_editor_rows']]
|
|
826
|
+
st.session_state.pop('seg_selection_editor', None)
|
|
827
|
+
|
|
811
828
|
editor_rows = list(st.session_state['seg_editor_rows'])
|
|
812
829
|
picked_keys = {(p['plane_num'], p['roi_num']) for p in picked}
|
|
813
830
|
|
|
814
|
-
# pending
|
|
831
|
+
# pending editor_rows so filtering sees the current values
|
|
815
832
|
widget_edits = (st.session_state.get('seg_selection_editor') or {}).get('edited_rows', {})
|
|
816
833
|
for i in range(len(editor_rows)):
|
|
817
834
|
edits = widget_edits.get(i, widget_edits.get(str(i), {}))
|
|
@@ -923,10 +940,8 @@ def segmentation_tab(schema=None):
|
|
|
923
940
|
if _bA.button('Save classification', key='seg_save_selection'):
|
|
924
941
|
_do_save(edited)
|
|
925
942
|
if _bB.button('Propagate first', key='seg_propagate_first',
|
|
926
|
-
disabled=edited.empty or edited['selection'].isna().all()):
|
|
943
|
+
disabled=edited.empty or bool(edited['selection'].isna().all())):
|
|
927
944
|
first_val = int(edited['selection'].dropna().iloc[0])
|
|
928
|
-
|
|
929
|
-
st.session_state['
|
|
930
|
-
st.session_state.pop('seg_selection_editor', None)
|
|
931
|
-
st.rerun()
|
|
945
|
+
st.session_state['_seg_propagate_pending'] = True
|
|
946
|
+
st.session_state['_seg_propagate_val'] = first_val
|
|
932
947
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|