Skip to content

Commit

Permalink
Merge pull request #151 from portugueslab/add_crop_param
Browse files Browse the repository at this point in the history
Add crop parameter to the save parameters
  • Loading branch information
nvbln authored Mar 4, 2024
2 parents 1529f8c + 6a09580 commit fdb2d74
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion sashimi/hardware/cameras/hamamatsu/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def get_property_value(self, property_name):
def set_property_value(self, property_name, property_value, *args, **kwargs):
# Check if the property exists.
if not (property_name in self.properties):

raise CameraException(f"Unknown property name {property_name}")

# If the value is text, figure out what the
Expand Down
1 change: 1 addition & 0 deletions sashimi/hardware/cameras/hamamatsu/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

# Hamamatsu structures.


## DCAMAPI_INIT
#
# The dcam initialization structure
Expand Down
1 change: 0 additions & 1 deletion sashimi/hardware/scanning/scanloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def __init__(
logger: ConcurrenceLogger,
trigger_exp_from_scanner,
):

self.sample_rate = sample_rate
self.n_samples = n_samples

Expand Down
1 change: 0 additions & 1 deletion sashimi/processes/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def camera_loop(self):
# if no frames are received (either this loop is in between frames
# or we are in the waining period)
if frames:

for frame in frames:
self.logger.log_message(
"received frame of shape " + str(frame.shape)
Expand Down
4 changes: 2 additions & 2 deletions sashimi/processes/streaming_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SavingParameters:
notification_email: str = "None"
volumerate: float = 1
voxel_size: tuple = (1, 1, 1)
crop: tuple = (0, 0, None, None)


@dataclass
Expand Down Expand Up @@ -175,8 +176,7 @@ def finalize_dataset(self):
self.save_parameters.chunk_size,
*self.current_data.shape[1:],
),
"crop_start": [0, 0, 0, 0],
"crop_end": [0, 0, 0, 0],
"crop": self.save_parameters.crop, # order of params here is [hpos, vpos, hsize, vsize,]
"padding": [0, 0, 0, 0],
"voxel_size": self.save_parameters.voxel_size,
},
Expand Down
5 changes: 3 additions & 2 deletions sashimi/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def get_voxel_size(
scanning_settings: Union[ZRecordingSettings, SinglePlaneSettings],
camera_settings: CameraSettings,
):

binning = int(camera_settings.binning)

if isinstance(scanning_settings, SinglePlaneSettings):
Expand Down Expand Up @@ -266,6 +265,9 @@ def convert_save_params(
notification_email=str(save_settings.notification_email),
volumerate=scanning_settings.frequency,
voxel_size=get_voxel_size(scanning_settings, camera_settings),
crop=[
int(item) for item in camera_settings.roi
], # int conversion makes it json serializable
)


Expand Down Expand Up @@ -669,7 +671,6 @@ def obtain_noise_average(self, n_images=50):
self.dispatcher.calibration_ref_queue.put(self.calibration_ref)

def reset_noise_subtraction(self):

self.calibration_ref = None
self.noise_subtraction_active.clear()

Expand Down

0 comments on commit fdb2d74

Please sign in to comment.