use of net.imglib2.FinalInterval in project vcell by virtualcell.
the class LargestRegionSlice method run.
@Override
public void run() {
int maxArea = 0;
int zOfMaxArea = 0;
for (int z = 0; z < data.dimension(2); z++) {
FinalInterval interval = Intervals.createMinMax(0, 0, z, data.dimension(0) - 1, data.dimension(1) - 1, z);
RandomAccessibleInterval<BitType> croppedRAI = ops.transform().crop(data, interval);
IterableInterval<BitType> croppedII = Views.iterable(croppedRAI);
Cursor<BitType> cursor = croppedII.cursor();
int area = 0;
while (cursor.hasNext()) {
if (cursor.next().get()) {
area++;
}
}
if (area > maxArea) {
maxArea = area;
zOfMaxArea = z;
}
}
FinalInterval interval = Intervals.createMinMax(0, 0, zOfMaxArea, data.dimension(0) - 1, data.dimension(1) - 1, zOfMaxArea);
output = ops.transform().crop(data, interval);
}
Aggregations