if (! view.isSelected()) continue;
OverlayView oView = (OverlayView)view;
if (mask == null) {
mask = createBitMask(display);
}
Overlay overlay = oView.getData();
/*
* The view can have an offset. Since there are two ways
* of handling the ROI, we offset the image instead of the view.
*
* We also will attempt to make the axes conform to what's
* expected by CP.
*/
RandomAccessibleInterval<BitType> adapter = mask;
long [] offset = new long[display.numDimensions()];
AxisType [] dAxes = new AxisType [] { Axes.Y, Axes.X };
for (int j=0; j<dAxes.length; j++) {
int i = overlay.dimensionIndex(dAxes[j]);
offset[j] = display.getLongPosition(dAxes[j]) - oView.getLongPosition(dAxes[j]);
if (i != j) {
/*
* Perform an axis permutation.
*/
adapter = Views.permute(adapter, j, i);
final AxisType temp = dAxes[i];
dAxes[i] = dAxes[j];
dAxes[j] = temp;
}
}
adapter = Views.translate(adapter, offset);
RegionOfInterest roi = overlay.getRegionOfInterest();
if (roi instanceof IterableRegionOfInterest) {
/*
* Yay! We can iterate over the pixels to turn each of them on.
*/
IterableInterval<BitType> ii =