22import numpy as np
33import h5py
44import copy
5+
56# from pyxalign.data_structures.task import LaminographyAlignmentTask
67from pyxalign .alignment .cross_correlation import CrossCorrelationAligner
78from pyxalign .api import enums
@@ -30,7 +31,7 @@ def __init__(
3031 masks : Optional [np .ndarray ] = None ,
3132 _initialize_from_loaded_data : bool = False ,
3233 _loaded_projections_dict : Optional [dict [str , XRFProjections ]] = None ,
33- ):
34+ ):
3435 self .projection_options = projection_options
3536 self .alignment_options = alignment_options
3637 # force proper typing
@@ -53,9 +54,9 @@ def __init__(
5354 # reinforce references
5455 for channel , proj in self .projections_dict .items ():
5556 proj .options = self .projection_options
56-
57+
5758 # if center_of_rotation is not None:
58- # self.center_of_rotation = center_of_rotation.astype(r_type)
59+ # self.center_of_rotation = center_of_rotation.astype(r_type)
5960 # else:
6061 self ._center_of_rotation = self .projections_dict [self ._primary_channel ].center_of_rotation
6162
@@ -141,7 +142,6 @@ def primary_channel(self, new_channel: str):
141142 for channel in self .channels :
142143 print (f"{ channel } " )
143144
144-
145145 def apply_staged_shift_to_all_channels (self , device_options : Optional [DeviceOptions ] = None ):
146146 for _ , projections in self .projections_dict .items ():
147147 projections .apply_staged_shift (device_options )
@@ -260,33 +260,12 @@ def save_task(self, file_path: str, save_channels: Optional[list[str]] = None):
260260 print (f"XRF task saved to { h5_obj .file .filename } { h5_obj .name } " )
261261 h5_obj ["task_file_type" ] = "xrf"
262262
263- # def launch_projections_viewer(self):
264-
265-
266- # # def launch_xrf_projections_viewer(self):
267-
268- # def load_task(file_path: str, exclude: list[str] = []) -> LaminographyAlignmentTask:
269- # print("Loading task from", file_path, "...")
270-
271- # with h5py.File(file_path, "r") as h5_obj:
272- # # Load projections
273- # loaded_projections = load_projections(h5_obj, exclude)
274-
275- # # Insert projections into task along with saved task options
276- # task = LaminographyAlignmentTask(
277- # options=load_options(h5_obj["options"], AlignmentTaskOptions),
278- # complex_projections=loaded_projections["complex_projections"],
279- # phase_projections=loaded_projections["phase_projections"],
280- # )
281-
282- # print("Loading complete")
283-
284- # return task
285-
286263
287264def load_xrf_task (file_path : str , exclude_channels : Optional [list [str ]] = None ) -> XRFTask :
288265 with h5py .File (file_path , "r" ) as h5_obj :
289- xrf_projections_dict = load_xrf_projections (task_h5_obj = h5_obj , exclude_channels = exclude_channels )
266+ xrf_projections_dict = load_xrf_projections (
267+ task_h5_obj = h5_obj , exclude_channels = exclude_channels
268+ )
290269 primary_channel = h5_obj ["primary_channel" ][()].decode ()
291270 alignment_options = load_options (h5_obj ["alignment_options" ], AlignmentTaskOptions )
292271 projection_options = load_options (h5_obj ["projection_options" ], ProjectionOptions )
@@ -309,4 +288,3 @@ def load_xrf_task(file_path: str, exclude_channels: Optional[list[str]] = None)
309288 )
310289
311290 return xrf_task
312-
0 commit comments