-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from tbirdso/scale-an-image
ENH: `ScaleAnImage` Python example and input data update
- Loading branch information
Showing
8 changed files
with
75 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
|
||
# ========================================================================= | ||
# | ||
# Copyright NumFOCUS | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# =========================================================================*/ | ||
|
||
import sys | ||
|
||
import itk | ||
|
||
if len(sys.argv) < 3: | ||
raise Exception(f"Usage: {sys.argv[0]} inputFile outputFile") | ||
|
||
image = itk.imread(sys.argv[1], itk.UC) | ||
|
||
image_dimension = image.GetImageDimension() | ||
|
||
transform = itk.ScaleTransform[itk.D, 2].New( | ||
scale=[1.5] * image_dimension, center=[x / 2 for x in itk.size(image)] | ||
) | ||
|
||
scaled_image = itk.resample_image_filter( | ||
image, transform=transform, size=itk.size(image) | ||
) | ||
|
||
itk.imwrite(scaled_image, sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
a2af37927b6e67dd7a1eceaa8b2b15837a872a91d04ad7df15d59e57c61d5ac1ce4ff11409de048c9d7a066adbbe4225af38d156e586dfead3c49059f1f2e581 | ||
3751db8b668657ed157daa5f7472ba2775feefbed331d8cd45c867089c5b5a535a10d55ec02cbf7c6cf73309f06636bc4001080b8bbc4f53dec205addd0ee41f |
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/Core/Transform/ScaleAnImage/ScaleAnImageOutputBaseline.png.sha512
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7ec9d81518d26754151a112affbe24a0f206b307aaa8c8bf8241a954e0974b6ea31a8b2982ce26d9de8eb4eeacba4003e16badfc9dd39aa7cd8827080360eb39 |
6d6bb4a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://examples.itk.org as production
🚀 Deployed on https://628b8b8f34ec3d4c66159a5c--itkexamples.netlify.app