- Notifications
You must be signed in to change notification settings - Fork269
ENH: Add get/set_zooms(units='norm') to manipulate zooms in mm/s units#567
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
3f3b450d26acfbde9323c5c303664b86d3eeb1d8ff6ba8b661357a3b096da88798fc4ef31aba527234c38899bc7da546651620f315d96f5c233f7f04babf086cd83f794cbd0dcfc5abe3562921d9199ca98e43a0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -580,6 +580,8 @@ def get_frame_affine(self, frame=0): | ||
| def get_zooms(self, frame=0, units='norm', raise_unknown=False): | ||
| """returns zooms ...pixdims""" | ||
| if units not in ('norm', 'raw'): | ||
| raise ValueError("`units` parameter must be 'norm' or 'raw'") | ||
| subhdr = self.subheaders[frame] | ||
| x_zoom = subhdr['x_pixel_size'] * 10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I wasn't sure whether to make | ||
| y_zoom = subhdr['y_pixel_size'] * 10 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -301,7 +301,11 @@ def set_zooms(self, zooms, units='norm'): | ||
| Zooms are specified in normalized units of mm/sec for | ||
| spatial/temporal dimensions or as raw values to be stored in | ||
| header. | ||
| .. _mghformat: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat#line-82 | ||
| """ | ||
| if units not in ('norm', 'raw'): | ||
| raise ValueError("`units` parameter must be 'norm' or 'raw'") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. too frequent of a code pattern. In current design I guess the only way to mitigate is to come up with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. We could do something like that. | ||
| hdr = self._structarr | ||
| zooms = np.asarray(zooms) | ||
| ndims = self._ndims() | ||