-
Notifications
You must be signed in to change notification settings - Fork 437
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
Cleaned PR for Visualization Modules to Assess the quality of Registration Qualitatively. #1606
Conversation
Hello @parichit, Thank you for updating !
Comment last updated on August 13, 2018 at 21:22 Hours UTC |
…rkflow. 1) Committing to this branch all the code from the affine_registration branch (PR 1581) 2) New PR should be opened for this branch.
…ile for test cases.
… dipy_align_affine.
…of mass' transformation rather than 'translation' when the progressive flag is off.
…ix the PEP8 issue.
19c44ce
to
b37d97d
Compare
…value of distance metric) to validate the tests by travis.
b37d97d
to
e06854a
Compare
…ilarity metric in the optimize() function of the imaffine.py file. 2) Changed the parameter documentation in the run() method of the alignpy file for improved view on the command line.
edcdfec
to
742f68b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1606 +/- ##
==========================================
- Coverage 87.34% 86.71% -0.64%
==========================================
Files 246 249 +3
Lines 31811 32344 +533
Branches 3451 3519 +68
==========================================
+ Hits 27785 28046 +261
- Misses 3204 3472 +268
- Partials 822 826 +4
Continue to review full report at Codecov.
|
…apply_transform. 2) Changed the body of 'rigid()' function in align.py to call the center_of_mass function when the progressive flag is off.
…t from the Syn_Registration flow. 2) Made the changes in the command line wrapper to use the changed name for the workflow.
… decreased the decimal precision to 1 decimal place for validating the travis tests.
…ng in the path of ApplyAffineWorkflow().
2) Added a utility funciton in the vis_register.py to check the slice type and raise the error.
… the numpy.all() method on the array.
742f68b
to
73fc149
Compare
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.
there is missing documentation for several functions and some are incomplete
overall I feel that the PR is too long and complex 8-)
@@ -1074,6 +1083,8 @@ def optimize(self, static, moving, transform, params0, | |||
self.params0 = self.transform.get_identity_parameters() | |||
|
|||
affine_map.set_affine(self.starting_affine) | |||
if ret_metric: | |||
return affine_map, opt.xopt, opt.fopt |
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 do not think that it is a good idea to optionally return a different number of results...
|
||
|
||
def load_nifti(fname, return_img=False, return_voxsize=False, | ||
return_coords=False): | ||
img = nib.load(fname) | ||
data = img.get_data() | ||
vox_size = img.header.get_zooms()[:3] | ||
|
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.
why new line?
--------- | ||
fname : str | ||
The file containing the saved affine matrix. | ||
""" |
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.
include return description
|
||
|
||
def save_quality_assur_metric(fname, xopt, fopt): | ||
""" |
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.
you should say that the output is text and back parsable because you add fopt
at the end of the file...
@@ -384,6 +389,9 @@ def overlay_slices(L, R, slice_index=None, slice_type=1, ltitle='Left', | |||
colorImage[..., 0] = ll * (ll > ll[0, 0]) | |||
colorImage[..., 1] = rr * (rr > rr[0, 0]) | |||
|
|||
if ret_slice: |
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 would rather use this function to return slice always and define a new function with a slice image as input and create a figure with an overlay
assert os.path.exists(affine_mat_file) | ||
return True | ||
|
||
test_com() |
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.
what is the reason for defining all this function when they are used only once
""" | ||
rows, cols = 0, 0 | ||
|
||
while True: |
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.
compute it directly, no loops are needed
num_slices += 5 - (num_slices % 5) if (num_slices % 5) > 0 else 0
for i in range(5, num_slices): | ||
|
||
if num_slices % i == 0: | ||
rows = i |
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.
compute it directly, no loops are needed
renderer.reset_camera() | ||
renderer.zoom(1.6) | ||
cnt += 1 | ||
if cnt > num_slices: |
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.
how/why this can happen?
|
||
num_slices = 0 | ||
|
||
if slice_type == 'sagittal': |
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 would use a dictionary
slice_dict = {
'sagittal': (x, 0),
'coronal': (y, 1),
'axial': (z, 2)
}
num_slices, slice_type = slice_dict[slice_type]
Is this PR still in progress? Looks like not much work has happened here recently, so I am going to close this. Feel free to reopen if you'd like to pick this up. |
This work was done as part of the Google Summer of Code (GSOC-2018) DIPY project titled 'DIPY Workflow(s) and Quality Assurance'
This work pertains to developing a workflow to visualize the quality of the registered images by creating a mosaic or the animation or both depending on the requirement. The plane to be visualized (Axial, Coronal or sagittal) can be easily controlled through the command line parameters.
This is a cleaned PR for the visualization modules developed to support the Image Registration Workflow(s). The PR1595 must not be merge now. Instead, this should be merged after making the changes in the core.py file for the GIF color range issues. The exact order of merging the PR's should be
PR1604 (affine registration workflow) -> PR1605 (apply transformation workflow) - > PR1606 (visualisation)
The link to the older PR (with all the conversations, commit history, improvements based on community feedback can be seen below):
#1595