Skip to content

Commit

Permalink
save also single plane params
Browse files Browse the repository at this point in the history
  • Loading branch information
fedem-p committed Jul 27, 2022
1 parent ed79248 commit d749689
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions sashimi/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from lightparam.param_qt import ParametrizedQt
from lightparam import Param, ParameterTree
from sashimi.hardware.light_source import light_source_class_dict
from typing import Union

# from sashimi.hardware import light_source_class_dict
from sashimi.processes.scanning import ScannerProcess
Expand Down Expand Up @@ -224,16 +225,20 @@ def calculate_calibration(self):


def get_voxel_size(
scanning_settings: ZRecordingSettings,
scanning_settings: Union[ZRecordingSettings, SinglePlaneSettings],
camera_settings: CameraSettings,
):
scan_length = (
scanning_settings.piezo_scan_range[1] - scanning_settings.piezo_scan_range[0]
)

binning = int(camera_settings.binning)

inter_plane = scan_length / scanning_settings.n_planes
if isinstance(scanning_settings, SinglePlaneSettings):
inter_plane = 1
else:
scan_length = (
scanning_settings.piezo_scan_range[1]
- scanning_settings.piezo_scan_range[0]
)
inter_plane = scan_length / scanning_settings.n_planes

return (
inter_plane,
Expand All @@ -244,13 +249,16 @@ def get_voxel_size(

def convert_save_params(
save_settings: SaveSettings,
scanning_settings: ZRecordingSettings,
scanning_settings: Union[ZRecordingSettings, SinglePlaneSettings],
camera_settings: CameraSettings,
trigger_settings: TriggerSettings,
):
n_planes = scanning_settings.n_planes - (
scanning_settings.n_skip_start + scanning_settings.n_skip_end
)
if isinstance(scanning_settings, SinglePlaneSettings):
n_planes = 0
else:
n_planes = scanning_settings.n_planes - (
scanning_settings.n_skip_start + scanning_settings.n_skip_end
)

return SavingParameters(
output_dir=Path(save_settings.save_dir),
Expand Down Expand Up @@ -472,12 +480,21 @@ def n_planes(self):

@property
def save_params(self):
return convert_save_params(
self.save_settings,
self.volume_setting,
self.camera_settings,
self.trigger_settings,
)
if self.global_state == GlobalState.PLANAR_PREVIEW:
save_p = convert_save_params(
self.save_settings,
self.single_plane_settings,
self.camera_settings,
self.trigger_settings,
)
else:
save_p = convert_save_params(
self.save_settings,
self.volume_setting,
self.camera_settings,
self.trigger_settings,
)
return save_p

@property
def scan_params(self):
Expand Down

0 comments on commit d749689

Please sign in to comment.