Display slice by slice #292
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Slice by slice viewer
To be able to display a huge image data in full scale we could display one slice at a time. This would imply that we rely on the data to not be fully loaded in the viewer, rather the viewer gets passed a reader and the reader provides the appropriate slice on request.
This could be achieved with cropped readers.
However, this also requires some changes in the viewer:
img3Dis avtkImageDataimg3Dis then passed as input to avtkExtractVOIfilter to create thevtkSliceobjectthat is rendered on the scene
setActiveSliceis called with the new slice number that one wants to select. This actually just stores an integerin list of length 3.
updatePipelineis called, which in turn calls eitherupdateImageWithOverlayPipelineorupdateRectilinearWipePipelinedepending on which visualisation mode we are using. Both methods trigger
updateMainVOIwhich sets the extentfor
vtkExtractVOIto the slice that we want to show and the appropriate slice is extracted and rendered.Proposed solution
If we need to rely on a file reader to render only part of the data we need to be able to pass a reader (or an output port) to the viewer. The viewer should be able to understand if it's passed a
vtkImageDataor a reader, and in the latter case modifyimg3Dwith the slice that's requested.This requires to make
img3DapropertyI tested this with a tiff dataset and a npy file.
Remaining issues
viewer3D. Do we need it there? Wouldn't it be better to pass the 3D viewer a downsampled version of the data? As a matter of fact a volume render would be rather impossible in full scale.SetExtentmethod to all cropped readers, possibly raising an error in case the required extent cannot be providedimg3D.GetExtent()which returns 0 for 1 slice.img3D.GetExtent()to figure out the centre slice.