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
Merge prep_cmr with image_transform plus tests #123
Conversation
Codecov Report
@@ Coverage Diff @@
## main #123 +/- ##
==========================================
+ Coverage 22.60% 24.50% +1.89%
==========================================
Files 38 37 -1
Lines 3012 2975 -37
==========================================
+ Hits 681 729 +48
+ Misses 2331 2246 -85
Continue to review full report at Codecov.
|
with pytest.raises(Exception): | ||
reg_img_stack(images, coords[1:, :]) | ||
images_reg, max_dist = reg_img_stack(images, coords) | ||
testing.assert_allclose(images_reg, images) |
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.
I did not get fully your logic here and can only guess. How did you make the registered images to be close to the original? I though you randomly perturbed the coordinates of the n-1 (9) images. After registration, they are close. Is it because the random noise is of small value compared to the coords? You can explain to me with a voice message in WeChat or Skype. Thanks.
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.
Sorry for the poor readability. Yes, the random noise to source coordinates are in (0, 1), which are small values compared to the image size. So the images after registration should be close to the original ones. The values in list max_dist
are very small. Maybe we can test whether max_dist + 1
is close to a ones vector (+1
for avoiding inf relative difference). Because we do not have real images and landmark coordinates for testing here, this is probably the easiest way for me to test the function. I will add more comments to improve the readability.
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.
Thanks for the clarification. That's helpful! Ready to merge.
kale/prepdata/image_transform.py
Outdated
if i == dst_id: | ||
continue | ||
else: | ||
# epts = landmarks.iloc[i, 1:].values |
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.
Still useful? Otherwise, remove.
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.
will remove it
|
||
from kale.prepdata.image_transform import mask_img_stack, reg_img_stack, rescale_img_stack | ||
|
||
gait = loadmat("tests/test_data/gait_gallery_data.mat") |
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.
Smart to use gait to test image stacks. Good reuse.
Fixes card.
Description
kale.prepdata.prep_cmr
withkale.prepdata.image_transform
.Status
Ready
Types of changes
docs
manually updated for new API.