-
Notifications
You must be signed in to change notification settings - Fork 4
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
distortion correction preview refactoring #161
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to the distortion correction method looks good to me 🙂 Though I don't understand why there's a random change to the nightly dev workflow file in this PR?
It's a bit muddled to have two totally unrelated issues tackled in the same PR, but if that must be done, could the "backup" file be removed completely instead of just being renamed? The backup of the file will exist in past states of the repo via version control, so removal of the file is cheap to do (ie, it's easy to find the backup file), without needing to keep the backup file under version control.
OK, I got rid of the
There is quite a lot of problems like this with Tomopy functions. |
Oh right, with the mention of the parsing YAML into a python tuple, are we planning on having users entering the values for Meaning, are we going to have something like the following in the YAML for the distortion correction: - method: standard_tomo
module_path: httomo.data.hdf.loaders
parameters:
name: tomo
data_path: entry1/tomo_entry/data/data
image_key_path: entry1/tomo_entry/instrument/detector/image_key
rotation_angles:
data_path: /entry1/tomo_entry/data/rotation_angle
preview:
detector_y:
start: DET_Y_START
step: DET_Y_STEP
detector_x:
start: DET_X_START
step: DET_X_STEP
.
.
.
- method: distortion_correction_proj_discorpy
module_path: httomolibgpu.prep.alignment
parameters:
metadata_path: /some/path
shift: [DET_X_START, DET_Y_START]
step: [DET_X_STEP, DET_Y_STEP]
order: 1
mode: reflect where the users have some value for The reason I ask is because I think the YAML would need to be parsed into a tuple only if the YAML contains the actual values to go into the distortion correction method? But then in order for the values for
Or have I misunderstood how this would work (which is very possible at this point...)? |
I see, we're indeed would like to deal with those parameters behind the scenes in HTTomo, so there is no need for us to expose those parameters in YAML to users? Yes, it makes sense then. We've got |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to it still not being clear how we'll change parameters in the method to allow httomo to pass the relevant info from the loader's preview
to the method, I won't make any changes here yet, just some comments about types.
shift: List[Union[int, int]] = [0, 0], | ||
step: List[Union[int, int]] = [1, 1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with a list, I think the correct type would be List[int]
. Currently, the type List[Union[int, int]]
contains the redundant type Union[int, int]
which means "an int
or an int
". Altogether, the type List[Union[int, int]]
means "a list of values with type int
or int
", which I imagine is not what was intended, and the intention more likely was "a list of values of type int
".
If we go with a tuple, the type should be Tuple[int, int]
.
shift: List, optional | ||
Centers of distortion in x (from the left of the image) and y directions (from the top of the image). | ||
|
||
step: List, optional | ||
Steps in x and y directions respectively. They need to be not larger than one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the other comment, a note about types.
If we go with a list, the type should be List[int]
(no optional
).
If we go with a tuple, the type should be Tuple[int, int]
(no optional
)
@@ -33,7 +33,7 @@ | |||
else: | |||
map_coordinates = Mock() | |||
|
|||
from typing import Dict, List | |||
from typing import Dict, List, Tuple, Union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things to note:
Union
isn't needed, regardless of if we choose a list or tuple for theshift
andstep
params- remove
Tuple
import if we go with a list
fixes #157 #160 and #163