@@ -33,9 +33,9 @@ class FIBAtlasMetadata(BaseModel):
3333 pos_x : float
3434 pos_y : float
3535 pos_z : float
36- rotation : float
37- tilt_alpha : float
38- tilt_beta : float
36+ rotation : float # Radians
37+ tilt_alpha : float # Radians
38+ tilt_beta : float # Radians
3939 # Image dimensions
4040 pixels_x : int
4141 pixels_y : int
@@ -132,8 +132,9 @@ def _register_fib_imaging_site(
132132 murfey_db : Session ,
133133):
134134 """
135- Register FIB atlas in Murfey database or update existing entry with newer image
135+ Register FIB atlas in Murfey database or update existing entry.
136136 """
137+ # Create new entry if one doesn't already exist
137138 if not (
138139 fib_imaging_site := murfey_db .exec (
139140 select (MurfeyDB .ImagingSite )
@@ -143,21 +144,23 @@ def _register_fib_imaging_site(
143144 ):
144145 fib_imaging_site = MurfeyDB .ImagingSite (
145146 session_id = session_id ,
146- site_name = metadata .site_name ,
147- data_type = "atlas" ,
148147 image_path = str (metadata .file ),
149- pos_x = metadata .pos_x ,
150- pos_y = metadata .pos_y ,
151- pos_z = metadata .pos_z ,
152- rotation = float (np .rad2deg (metadata .rotation )),
153- tilt_alpha = float (np .rad2deg (metadata .tilt_alpha )),
154- tilt_beta = float (np .rad2deg (metadata .tilt_beta )),
155- len_x = metadata .len_x ,
156- len_y = metadata .len_y ,
157- image_pixels_x = metadata .pixels_x ,
158- image_pixels_y = metadata .pixels_y ,
159- image_pixel_size = metadata .pixel_size ,
148+ data_type = "atlas" ,
160149 )
150+ # Add/update entries
151+ fib_imaging_site .site_name = metadata .site_name
152+ fib_imaging_site .pos_x = metadata .pos_x
153+ fib_imaging_site .pos_y = metadata .pos_y
154+ fib_imaging_site .pos_z = metadata .pos_z
155+ fib_imaging_site .rotation = float (np .rad2deg (metadata .rotation ))
156+ fib_imaging_site .tilt_alpha = float (np .rad2deg (metadata .tilt_alpha ))
157+ fib_imaging_site .tilt_beta = float (np .rad2deg (metadata .tilt_beta ))
158+ fib_imaging_site .len_x = metadata .len_x
159+ fib_imaging_site .len_y = metadata .len_y
160+ fib_imaging_site .image_pixels_x = metadata .pixels_x
161+ fib_imaging_site .image_pixels_y = metadata .pixels_y
162+ fib_imaging_site .image_pixel_size = metadata .pixel_size
163+
161164 murfey_db .add (fib_imaging_site )
162165 murfey_db .commit ()
163166
0 commit comments