Skip to content
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

Fix HDF5 cropped reader #462

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## v25.0.0

Bugfix:
- Fix `cilHDF5CroppedReader` #462

Enhancements:
- Have `hdf5_attrs` as attribute to `HDF5InputDialog` #452
- Add `SaveableRawInputDialog` #444
Expand Down
1 change: 0 additions & 1 deletion Wrappers/Python/ccpi/viewer/CILViewer2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ def OnMouseWheelBackward(self, interactor, event):
def AutoWindowLevelOnVolumeRange(self, update_slice=True):
'''Auto-adjusts window-level for the slice, based on the 5 and 95th percentiles of the whole image volume.'''
cmin, cmax = self._viewer.getImageMapRange((5., 95.), method="scalar")
print("Auto range for volume: ", cmin, cmax)
window, level = self._viewer.getSliceWindowLevelFromRange(cmin, cmax)

self._viewer.imageSlice.GetProperty().SetColorLevel(level)
Expand Down
7 changes: 6 additions & 1 deletion Wrappers/Python/ccpi/viewer/utils/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,12 +1713,17 @@ def RequestData(self, request, inInfo, outInfo):
full_reader = HDF5Reader()
full_reader.SetFileName(self.GetFileName())
full_reader.SetDatasetName(self.GetDatasetName())
dimensions = full_reader.GetDimensions()
reader = HDF5SubsetReader()
reader.SetInputConnection(full_reader.GetOutputPort())
# Either the TargetExtent or TargetZExtent should have been set.
# We prioritise the TargetExtent
if self.GetTargetExtent() is None:
extent = [0, -1, 0, -1, self.GetTargetZExtent[0], self.GetTargetZExtent[1]]
extent = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should actually use the extent rather than the dimensions, but it should be fine for the time being. Maybe we should later add an issue.

0, dimensions[0] - 1, 0, dimensions[1] - 1,
self.GetTargetZExtent()[0],
self.GetTargetZExtent()[1]
]
else:
extent = self.GetTargetExtent()
reader.SetUpdateExtent(extent)
Expand Down
Loading