Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP404 module doesn't always respect 'clear_borders' setting #448

Closed
ckswilliams opened this issue May 24, 2023 · 1 comment
Closed

CTP404 module doesn't always respect 'clear_borders' setting #448

ckswilliams opened this issue May 24, 2023 · 1 comment

Comments

@ckswilliams
Copy link
Contributor

ckswilliams commented May 24, 2023

Describe the bug
When running analysis on CTP404, the 'clear_borders' setting is ignored. This results in the script failing to localise the phantom, which causes subsequent errors.

To Reproduce
Steps to reproduce the behavior:

  1. Have a CatPhan image set that isn't well segmented by the get_regions algorithm
  2. ctp = CatPhan404(folder)
  3. ctp.clear_borders=False
  4. ctp.analyze()
  5. See error
  Cell In[81], line 1
    ctp504_5.analyze()

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:1994 in analyze
    self.ctp404 = ctp404(

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:594 in __init__
    super().__init__(catphan, tolerance=hu_tolerance, offset=offset)

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:367 in __init__
    self._setup_rois()

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:610 in _setup_rois
    super()._setup_rois()

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:416 in _setup_rois
    self.background_rois[name] = HUDiskROI(

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\ct.py:183 in __init__
    super().__init__(array, angle, roi_radius, dist_from_center, phantom_center)

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\core\roi.py:67 in __init__
    center = self._get_shifted_center(angle, dist_from_center, phantom_center)

  File ~\Anaconda3\envs\gp\lib\site-packages\pylinac\core\roi.py:80 in _get_shifted_center
    return Point(phantom_center.x + x_shift, phantom_center.y + y_shift)

AttributeError: 'NoneType' object has no attribute 'x'

** Proposed solution **
Add a new line at line 607, in CTP404CP504.preprocess:
clear_borders = self.clear_borders,

I'll try to make a pull request for this.

@jrkerns
Copy link
Owner

jrkerns commented Nov 9, 2023

Closing as this was fixed in referenced PR.

@jrkerns jrkerns closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants