-
Notifications
You must be signed in to change notification settings - Fork 5
ENH: Validate PET data objects' attributes at instantiation #336
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
base: main
Are you sure you want to change the base?
Conversation
|
Depends on PR #335. |
e094509 to
a548cbc
Compare
a548cbc to
96e916b
Compare
|
@mnoergaard While working on this I've realized that as things stand now on
I think that answer will allow me to refactor this properly and avoid inconsistencies. Thanks. |
@jhlegarreta - that is correct! Thanks. |
745e408 to
bc7617e
Compare
|
@mnoergaard Please, see if the refactoring for the PET data class instantiation and |
bc7617e to
7dc1033
Compare
Validate PET data objects' attributes at instantiation: ensures that the attributes are present and match the expected dimensionalities. Refactor the PET attributes so that only the required (`frame_time` and `uptake`) and optional (`frame_duration`) parameters are accepted by the constructor. The `midframe` and the `total_duration` attributes can be computed from the required parameters, so exclude it from `__init__`. Although `uptake` can also be computed from the PET frame data, the rationale behind requiring it is similar to the one for the DWI class `bzero`: users will be able compute the `uptake` using their preferred strategy and provide it to the constructor. For the `from_nii` function, if a callable is provided, it will be used to compute the value; otherwise a default strategy is used to compute it. Refactor the `from_nii` function so that the required parameters are present when instantiating the PET instance. Increase consistency with the `dmri` data module `from_nii` counterpart function. Refactor the PET data creation fixture in `conftest.py` to accept the required/optional arguments and to return the necessary data. Refactor the tests accordingly and increase consistency with the `dmri` data module testing helper functions. Reduces cognitive load and maintenance burden. Add additional object instantiation equality checks: check that objects intantiated through reading NIfTI files equal objects instantiated directly.
7dc1033 to
803b020
Compare
Validate PET data objects' attributes at instantiation: ensures that the attributes are present and match the expected dimensionalities.