001/** 002 * 003 */ 004package plugins.kernel.roi.roi3d; 005 006import icy.type.geom.Polygon2D; 007 008import plugins.kernel.roi.roi2d.ROI2DPolygon; 009 010/** 011 * Class defining a 3D Stack Polygon ROI as a stack of individual 2D Polygon ROI. 012 * 013 * @author Stephane 014 */ 015public class ROI3DStackPolygon extends ROI3DStackShape 016{ 017 public ROI3DStackPolygon() 018 { 019 super(ROI2DPolygon.class); 020 } 021 022 public ROI3DStackPolygon(Polygon2D polygon, int zMin, int zMax) 023 { 024 this(); 025 026 if (zMax < zMin) 027 throw new IllegalArgumentException("ROI3DStackPolygon: cannot create the ROI (zMax < zMin)."); 028 029 beginUpdate(); 030 try 031 { 032 for (int z = zMin; z <= zMax; z++) 033 setSlice(z, new ROI2DPolygon(polygon)); 034 } 035 finally 036 { 037 endUpdate(); 038 } 039 } 040 041 @Override 042 public String getDefaultName() 043 { 044 return "Polygon2D stack"; 045 } 046}