@@ -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,10 +474,7 @@ 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
480- else :
481- cor = ncol - overlap / 2.0 - 1.0
477+ cor = ncol - overlap / 2
482478
483479 return cor , overlap , side , overlap_position
484480
@@ -498,10 +494,9 @@ def _find_overlap(
498494 2D array. Projection image or sinogram image.
499495 win_width : int
500496 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.
497+ side : {None, left, right}, optional
498+ Chose between "left", "right" or "None" which corresponds to fully
499+ automated determination of the side.
505500 denoise : bool, optional
506501 Apply the Gaussian filter if True.
507502 norm : bool, optional
@@ -514,8 +509,8 @@ def _find_overlap(
514509 -------
515510 overlap : float
516511 Width of the overlap area between two images.
517- side : int
518- Overlap side between two images.
512+ side : str
513+ Overlap side (left or right) between two images.
519514 overlap_position : float
520515 Position of the window in the first image giving the best
521516 correlation metric.
@@ -525,25 +520,25 @@ def _find_overlap(
525520 ncol2 = mat2 .shape [1 ]
526521 win_width = int (np .clip (win_width , 6 , min (ncol1 , ncol2 ) // 2 ))
527522
528- if side == 1 :
523+ if side == "right" :
529524 (list_metric , offset ) = _search_overlap (
530525 mat1 ,
531526 mat2 ,
532527 win_width ,
533- side = side ,
528+ side = 1 , # right side
534529 denoise = denoise ,
535530 norm = norm ,
536531 use_overlap = use_overlap ,
537532 )
538533 overlap_position = _calculate_curvature (list_metric )[1 ]
539534 overlap_position += offset
540535 overlap = ncol1 - overlap_position + win_width // 2
541- elif side == 0 :
536+ elif side == "left" :
542537 (list_metric , offset ) = _search_overlap (
543538 mat1 ,
544539 mat2 ,
545540 win_width ,
546- side = side ,
541+ side = 0 , # left side
547542 denoise = denoise ,
548543 norm = norm ,
549544 use_overlap = use_overlap ,
@@ -556,7 +551,7 @@ def _find_overlap(
556551 mat1 ,
557552 mat2 ,
558553 win_width ,
559- side = 1 ,
554+ side = 1 , # right side
560555 denoise = denoise ,
561556 norm = norm ,
562557 use_overlap = use_overlap ,
@@ -565,7 +560,7 @@ def _find_overlap(
565560 mat1 ,
566561 mat2 ,
567562 win_width ,
568- side = 0 ,
563+ side = 0 , # left side
569564 denoise = denoise ,
570565 norm = norm ,
571566 use_overlap = use_overlap ,
@@ -577,11 +572,11 @@ def _find_overlap(
577572 overlap_position2 += offset2
578573
579574 if curvature1 > curvature2 :
580- side = 1
575+ side = "right"
581576 overlap_position = overlap_position1
582577 overlap = ncol1 - overlap_position + win_width // 2
583578 else :
584- side = 0
579+ side = "left"
585580 overlap_position = overlap_position2
586581 overlap = overlap_position + win_width // 2
587582
0 commit comments