Skip to content

Commit

Permalink
Merge branch 'master' into toolbar3d
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramurgatroyd authored Aug 2, 2023
2 parents 1fe6440 + 8c7caca commit 7c5c184
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Describe your changes


## Describe any testing you have performed
*Consider adding example code to [examples](https://github.com/vais-ral/CILViewer/tree/pr-template/Wrappers/Python/examples)*


## Link relevant issues


## Checklist when you are ready to request a review

- [ ] I have performed a self-review of my code
- [ ] I have added docstrings in line with the guidance in the [CIL developer guide](https://tomographicimaging.github.io/CIL/nightly/developer_guide.html)
- [ ] I have implemented unit tests that cover any new or modified functionality
- [ ] CHANGELOG.md has been updated with any functionality change
- [ ] Request review from all relevant developers
- [ ] Change pull request label to 'waiting for review'

## Contribution Notes
- [ ] The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in CILViewer (the Work) under the terms and conditions of the [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html)
- [ ] I confirm that the contribution does not violate any intellectual property rights of third parties

Qt contributions should follow Qt naming conventions i.e. camelCase method names.

VTK contributions should follow VTK naming conventions i.e. PascalCase method names.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## v23.x.x
- adds Qt GUI toolbar to control 3D viewer
- Fix bug with setInputAsNumpy() using deprecated `numpy2vtkImporter` in `CILViewer2D` - now uses `numpy2vtkImage`

## v23.1.0
- Raise error if try to add multiple widgets with the same name to CILViewer or CILViewer2D.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ conda create --name cilviewer ccpi-viewer=23.1.0 -c ccpi -c paskino -c conda-for

## Running the CILViewer app

- Activate your environment using: ``conda activate cil-viewer``.
- Activate your environment using: ``conda activate cilviewer``.
- Launch by typing: `cilviewer`
- Load a dataset using the File menu. Currently supported data formats:
- HDF5, including Nexus
Expand Down
9 changes: 4 additions & 5 deletions Wrappers/Python/ccpi/viewer/CILViewer2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,13 +1171,12 @@ def setInputAsNumpy(self,
dtype=vtk.VTK_UNSIGNED_SHORT):
self.rescale[0] = rescale

importer = Converter.numpy2vtkImporter(numpyarray, spacing, origin)
importer.Update()
img = Converter.numpy2vtkImage(numpyarray, spacing, origin)

if rescale:
# rescale to appropriate VTK_UNSIGNED_SHORT
stats = vtk.vtkImageAccumulate()
stats.SetInputData(importer.GetOutput())
stats.SetInputData(img)
stats.Update()
iMin = stats.GetMin()[0]
iMax = stats.GetMax()[0]
Expand All @@ -1191,14 +1190,14 @@ def setInputAsNumpy(self,

self.rescale[1] = (scale, -iMin)
shiftScaler = vtk.vtkImageShiftScale()
shiftScaler.SetInputData(importer.GetOutput())
shiftScaler.SetInputData(img)
shiftScaler.SetScale(scale)
shiftScaler.SetShift(-iMin)
shiftScaler.SetOutputScalarType(dtype)
shiftScaler.Update()
self.img3D = shiftScaler.GetOutput()
else:
self.img3D = importer.GetOutput()
self.img3D = img

self.installPipeline()

Expand Down

0 comments on commit 7c5c184

Please sign in to comment.