-
Notifications
You must be signed in to change notification settings - Fork 532
added interface for ANTs' MeasureImageSimilarity #2128
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
Conversation
38c4d55
to
efd4409
Compare
Codecov Report
@@ Coverage Diff @@
## master #2128 +/- ##
==========================================
+ Coverage 70.33% 71.31% +0.97%
==========================================
Files 1153 1141 -12
Lines 57584 57391 -193
Branches 8327 8254 -73
==========================================
+ Hits 40501 40926 +425
+ Misses 15596 15103 -493
+ Partials 1487 1362 -125
Continue to review full report at Codecov.
|
I'm pretty sure the circleci error:
is not due to my PR. |
@TheChymera Yeah, that error is showing up in pretty much all builds these days. |
:) so, can anybody pull? |
I can review in a bit. |
class MeasureImageSimilarityInputSpec(ANTSCommandInputSpec): | ||
dimension = traits.Enum( | ||
2, 3, 4, | ||
argstr='--dimensionality %d', usedefault=False, |
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 believe the preference is not to explicitly set parameters with their defaults, so I'd remove usedefault=False
.
usedefault=False
desc=('image to which the moving image is warped'), | ||
) | ||
moving_image = File( | ||
exists=True,mandatory=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.
Space after comma.
) | ||
moving_image = File( | ||
exists=True,mandatory=True, | ||
desc=('image to apply transformation to (generally a coregistered functional)'), |
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.
Parentheses not needed
argstr="%s", mandatory=True, | ||
) | ||
metric_weight = traits.Float(requires=['metric'], desc='',mandatory=True,) | ||
radius_or_number_of_bins = traits.Int(requires=['metric'], desc='',mandatory=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.
Space after comma (both of the above lines)
radius_or_number_of_bins = traits.Int(requires=['metric'], desc='',mandatory=True,) | ||
sampling_strategy = traits.Enum( | ||
"None", "Regular", "Random", None, | ||
requires=['metric'],mandatory=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.
Space after comma.
metric_weight = traits.Float(requires=['metric'], desc='',mandatory=True,) | ||
radius_or_number_of_bins = traits.Int(requires=['metric'], desc='',mandatory=True,) | ||
sampling_strategy = traits.Enum( | ||
"None", "Regular", "Random", None, |
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.
Is None
a valid option here? I think it will mess up _metric_constructor()
.
requires=['metric'],mandatory=True, | ||
) | ||
sampling_percentage = traits.Either( | ||
traits.Range(low=0.0, high=1.0), None, |
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.
Again RE: None
|
||
|
||
class MeasureImageSimilarityOutputSpec(TraitedSpec): | ||
similarity =traits.Float() |
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.
Space after =
|
||
class MeasureImageSimilarity(ANTSCommand): | ||
|
||
""" |
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.
No newline before docstring. Can you add a basic description of MeasureImageSimilarity
? e.g.:
"Calculate the similarity between two images using various metrics."
def _list_outputs(self): | ||
outputs = self._outputs() | ||
stdout = runtime.stdout.split('\n') | ||
outputs['similarity'] = float(stdout) |
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.
stdout
should be a list. You probably want float(stdout[0])
.
@effigies I addressed the outstanding issues, except the docstring description. None of the other ANTs interfaces in this module have one, so if anything maybe a more general documentation commit would be in order for that. circleci seems to fail due to a docker issue:
|
Circle fails sometimes. Go ahead and rebuild it. |
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.
Also, run make specs
and add the test_auto_MeasureImageSimilarity.py
test.
"CC", "MI", "Mattes", "MeanSquares", "Demons", "GC", | ||
argstr="%s", mandatory=True, | ||
) | ||
metric_weight = traits.Float(requires=['metric'], desc='',mandatory=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.
Space after commas, no comma before close paren. Any chance of a non-empty desc
?
argstr="%s", mandatory=True, | ||
) | ||
metric_weight = traits.Float(requires=['metric'], desc='',mandatory=True,) | ||
radius_or_number_of_bins = traits.Int(requires=['metric'], desc='',mandatory=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.
Space after commas, no comma before close paren. Any chance of a non-empty desc
?
radius_or_number_of_bins = traits.Int(requires=['metric'], desc='',mandatory=True,) | ||
sampling_strategy = traits.Enum( | ||
"None", "Regular", "Random", | ||
requires=['metric'],mandatory=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.
Space after comma. Desc?
) | ||
sampling_percentage = traits.Either( | ||
traits.Range(low=0.0, high=1.0), | ||
requires=['metric'], mandatory=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.
Desc?
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.
LGTM
New interface, as discussed earlier. @satra