@@ -416,27 +416,26 @@ def find_center_360(
416416 data : cp .ndarray ,
417417 ind : Optional [int ] = None ,
418418 win_width : int = 10 ,
419- side : Optional [Literal [0 , 1 ]] = None ,
419+ side : Optional [Literal ["left" , "right" ]] = None ,
420420 denoise : bool = True ,
421421 norm : bool = False ,
422422 use_overlap : bool = False ,
423- ) -> Tuple [float , float , Optional [Literal [0 , 1 ]], float ]:
423+ ) -> Tuple [np . float32 , np . float32 , Optional [Literal ["left" , "right" ]], np . float32 ]:
424424 """
425425 Find the center-of-rotation (COR) in a 360-degree scan and also an offset
426426 to perform data transformation from 360 to 180 degrees scan. See :cite:`vo2021data`.
427427
428- Parameters
428+ Parameters Tuple[np.float32, np.float32, Literal["left", "right"], np.float32]:
429429 ----------
430430 data : cp.ndarray
431431 3D tomographic data as a Cupy array.
432432 ind : int, optional
433433 Index of the slice to be used for estimate the CoR and the overlap.
434434 win_width : int, optional
435435 Window width used for finding the overlap area.
436- side : {None, 0, 1}, optional
437- Overlap size. Only there options: None, 0, or 1. "None" corresponds
438- to fully automated determination. "0" corresponds to the left side.
439- "1" corresponds to the right side.
436+ side : {None, left, right}, optional
437+ Chose between "left", "right" or "None" which corresponds to fully
438+ automated determination of the side.
440439 denoise : bool, optional
441440 Apply the Gaussian filter if True.
442441 norm : bool, optional
@@ -451,8 +450,8 @@ def find_center_360(
451450 Center-of-rotation.
452451 overlap : float
453452 Width of the overlap area between two halves of the sinogram.
454- side : int
455- Overlap side between two halves of the sinogram.
453+ side : str
454+ Overlap side (left or right) between two halves of the sinogram.
456455 overlap_position : float
457456 Position of the window in the first image giving the best
458457 correlation metric.
@@ -475,8 +474,9 @@ def find_center_360(
475474 (overlap , side , overlap_position ) = _find_overlap (
476475 sino_top , sino_bot , win_width , side , denoise , norm , use_overlap
477476 )
478- if side == 0 :
479- cor = overlap / 2.0 - 1.0
477+ if side == "left" :
478+ # cor = overlap / 2.0 - 1.0
479+ cor = ncol // 2 # NOTE: major correction to check!
480480 else :
481481 cor = ncol - overlap / 2.0 - 1.0
482482
@@ -498,10 +498,9 @@ def _find_overlap(
498498 2D array. Projection image or sinogram image.
499499 win_width : int
500500 Width of the searching window.
501- side : {None, 0, 1}, optional
502- Only there options: None, 0, or 1. "None" corresponding to fully
503- automated determination. "0" corresponding to the left side. "1"
504- corresponding to the right side.
501+ side : {None, left, right}, optional
502+ Chose between "left", "right" or "None" which corresponds to fully
503+ automated determination of the side.
505504 denoise : bool, optional
506505 Apply the Gaussian filter if True.
507506 norm : bool, optional
@@ -514,8 +513,8 @@ def _find_overlap(
514513 -------
515514 overlap : float
516515 Width of the overlap area between two images.
517- side : int
518- Overlap side between two images.
516+ side : str
517+ Overlap side (left or right) between two images.
519518 overlap_position : float
520519 Position of the window in the first image giving the best
521520 correlation metric.
@@ -525,25 +524,25 @@ def _find_overlap(
525524 ncol2 = mat2 .shape [1 ]
526525 win_width = int (np .clip (win_width , 6 , min (ncol1 , ncol2 ) // 2 ))
527526
528- if side == 1 :
527+ if side == "right" :
529528 (list_metric , offset ) = _search_overlap (
530529 mat1 ,
531530 mat2 ,
532531 win_width ,
533- side = side ,
532+ side = 1 , # right side
534533 denoise = denoise ,
535534 norm = norm ,
536535 use_overlap = use_overlap ,
537536 )
538537 overlap_position = _calculate_curvature (list_metric )[1 ]
539538 overlap_position += offset
540539 overlap = ncol1 - overlap_position + win_width // 2
541- elif side == 0 :
540+ elif side == "left" :
542541 (list_metric , offset ) = _search_overlap (
543542 mat1 ,
544543 mat2 ,
545544 win_width ,
546- side = side ,
545+ side = 0 , # left side
547546 denoise = denoise ,
548547 norm = norm ,
549548 use_overlap = use_overlap ,
@@ -556,7 +555,7 @@ def _find_overlap(
556555 mat1 ,
557556 mat2 ,
558557 win_width ,
559- side = 1 ,
558+ side = 1 , # right side
560559 denoise = denoise ,
561560 norm = norm ,
562561 use_overlap = use_overlap ,
@@ -565,7 +564,7 @@ def _find_overlap(
565564 mat1 ,
566565 mat2 ,
567566 win_width ,
568- side = 0 ,
567+ side = 0 , # left side
569568 denoise = denoise ,
570569 norm = norm ,
571570 use_overlap = use_overlap ,
@@ -577,11 +576,11 @@ def _find_overlap(
577576 overlap_position2 += offset2
578577
579578 if curvature1 > curvature2 :
580- side = 1
579+ side = "right"
581580 overlap_position = overlap_position1
582581 overlap = ncol1 - overlap_position + win_width // 2
583582 else :
584- side = 0
583+ side = "left"
585584 overlap_position = overlap_position2
586585 overlap = overlap_position + win_width // 2
587586
0 commit comments