Image Geometry get_slice returns IG with offset centre - #2235
Image Geometry get_slice returns IG with offset centre#2235lauramurgatroyd wants to merge 14 commits into
Conversation
…Imaging/CIL into image_geom_get_slice
Added new features related to image geometry and slicing. Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
hrobarts
left a comment
There was a problem hiding this comment.
Hi Laura, this looks really useful. Just a couple of questions.
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
|
Can we have a meeting about this, maybe we could discuss it in a dev meeting. I remember lots of discussions about axis lengths or 0 vs 1 and what it meant, but I don't remember what we landed on or what the implications were. |
| if vertical == 0: | ||
| warnings.warn("Slicing vertical at index 0 results in a geometry \ | ||
| offset along the vertical axis. If you do not require an offset ImageGeometry, set vertical='centre", | ||
| UserWarning) |
There was a problem hiding this comment.
@gfardell - this is what we decided on previously - to raise a warning if they set vertical=0
|
|
||
| if vertical is not None: | ||
| geometry_new.voxel_num_z = 0 | ||
| geometry_new.voxel_num_z = 1 |
There was a problem hiding this comment.
Note this does not mean the shape is 1 in this dimension:
CIL/Wrappers/Python/cil/framework/image_geometry.py
Lines 101 to 107 in 8ad816b
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
| def get_slice(self,channel=None, vertical=None, horizontal_x=None, horizontal_y=None): | ||
| ''' | ||
| Returns a new ImageGeometry of a single slice of in the requested direction. | ||
| Returns a new ImageGeometry of a single slice in the requested direction. |
There was a problem hiding this comment.
Not clear where index 0 sits
| def get_slice(self,channel=None, vertical=None, horizontal_x=None, horizontal_y=None): | ||
| ''' | ||
| Returns a new ImageGeometry of a single slice of in the requested direction. | ||
| Returns a new ImageGeometry of a single slice in the requested direction. |
There was a problem hiding this comment.
make really clear, single 2D slice in 3D space with offset calculated from where it was in 3D original object
Puts one slice at location where it was requested
offset is height of slice from centre
Add example - if used with vertical this is what you'd get
|
After discussion with @gfardell and @paskino today, updating ImageGeometry and ImageData significantly.
|
Description
Closes #2217
Example Usage
Contribution Notes
Changes
Testing you performed
Added unit tests for:
Related issues/links
Checklist