Created
December 10, 2011 04:51
-
-
Save acardona/1454607 to your computer and use it in GitHub Desktop.
A virtual image of ImgLib2 with a filled ROI
This file contains hidden or 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
// Goal: a virtual image (a function, if you want) | |
// with dimensions 512, 512 | |
// and a background of value 0 | |
// and a ROI of dimensions 200, 200 at position 100, 100 | |
// filled with a value 127. | |
// ERROR: the ROI has the right dimensions | |
// but its top-left is positioned with negative coordinates. | |
// A virtual image with a ROI filled with value 127 | |
RandomAccessibleInterval<FloatType> img1 = | |
// The 'image' | |
Views.interval( | |
// The outside, with value 0 | |
Views.extendValue( | |
// The ROI filled with value 127 | |
Views.interval( | |
new ConstantRandomAccessible<FloatType>(new FloatType(127), 2), | |
// The domain of the ROI | |
new long[]{100, 100}, | |
new long[]{199, 199}), | |
new FloatType(0)), | |
// The domain of the image | |
new long[]{0, 0}, | |
new long[]{511, 511}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment