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

[bug] KeyError: 'bias_correct' #53

Closed
neuronflow opened this issue Mar 30, 2024 · 4 comments · Fixed by #54
Closed

[bug] KeyError: 'bias_correct' #53

neuronflow opened this issue Mar 30, 2024 · 4 comments · Fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@neuronflow
Copy link
Contributor

throws error:

(brainles2) (base) florian@a4000-21an1:~/flow/BrainLesion/preprocessing$ /home/florian/miniconda3/envs/brainles2/bin/python /home/florian/flow/BrainLesion/preprocessing/ereg_tests/try_ereg.py
Traceback (most recent call last):
  File "/home/florian/flow/BrainLesion/preprocessing/ereg_tests/try_ereg.py", line 11, in <module>
    registration_obj.register(
  File "/home/florian/miniconda3/envs/brainles2/lib/python3.10/site-packages/ereg/registration.py", line 153, in register
    if self.parameters["bias_correct"]:
KeyError: 'bias_correct'

reproducible example:

t1c = "/home/florian/flow/BrainLesion/preprocessing/example/example_data/OtherEXampleFromTCIA/MRHR_T1_AX_POST_GAD_OtherEXampleTCIA_TCGA-FG-6692_Si_TCGA-FG-6692_MRHR_T1_AX_POST_GAD_SE_13_se2d1r_t1c.nii.gz"

fla = "/home/florian/flow/BrainLesion/preprocessing/example/example_data/OtherEXampleFromTCIA/MRHR_FLAIR_AX_OtherEXampleTCIA_TCGA-FG-6692_Si_TCGA-FG-6692_MRHR_FLAIR_AX_SE_IR_5_tir2d1_21_fla.nii.gz"


from ereg.registration import RegistrationClass

registration_obj = (
    RegistrationClass()
)  # the configuration file to use to customize the registration, and is optional
registration_obj.register(
    target_image=t1c,  # the target image, which can be either a file or SimpleITK.Image object
    moving_image=fla,  # the moving image, which can be either a file or SimpleITK.Image object
    output_image="/home/florian/flow/BrainLesion/preprocessing/ereg_tests/warped.nii.gz",  # the output image to save the registered image to
    transform_file="/home/florian/flow/BrainLesion/preprocessing/ereg_tests/transform.mat",  # the transform file to save the transform to; if already present, will use this transform instead of computing a new one
    log_file="/home/florian/flow/BrainLesion/preprocessing/ereg_tests/log.log",  # the log file to write to
)

@neuronflow neuronflow added the bug Something isn't working label Mar 30, 2024
@neuronflow
Copy link
Contributor Author

that also seems to be blocking here:
BrainLesion/preprocessing#49

@neuronflow
Copy link
Contributor Author

I am using this example data for my tests:
https://github.com/BrainLesion/preprocessing/tree/main/example/example_data

@sarthakpati sarthakpati linked a pull request Mar 30, 2024 that will close this issue
@neuronflow
Copy link
Contributor Author

neuronflow commented Mar 30, 2024

@sarthakpati hmm now I get:

(brainles2) (base) florian@a4000-21an1:~/flow/BrainLesion/preprocessing$ /home/florian/miniconda3/envs/brainles2/bin/python /home/florian/flow/BrainLesion/preprocessing/ereg_tests/try_ereg.py
Traceback (most recent call last):
  File "/home/florian/flow/BrainLesion/preprocessing/ereg_tests/try_ereg.py", line 11, in <module>
    registration_obj.register(
  File "/home/florian/miniconda3/envs/brainles2/lib/python3.10/site-packages/ereg/registration.py", line 174, in register
    self.transform = self._register_image_and_get_transform(
  File "/home/florian/miniconda3/envs/brainles2/lib/python3.10/site-packages/ereg/registration.py", line 392, in _register_image_and_get_transform
    metric = self.parameters["metric"].lower()
KeyError: 'metric'

we need unit tests to avoid breaking things:
#52

@neuronflow
Copy link
Contributor Author

#56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants