001package plugins.kernel.roi.roi4d;
002
003import icy.type.rectangle.Rectangle3D;
004import icy.type.rectangle.Rectangle4D;
005
006import plugins.kernel.roi.roi3d.ROI3DStackRectangle;
007
008public class ROI4DStackRectangle extends ROI4DStack<ROI3DStackRectangle>
009{
010    public ROI4DStackRectangle()
011    {
012        super(ROI3DStackRectangle.class);
013
014        setName("4D rectangle");
015    }
016
017    public ROI4DStackRectangle(Rectangle4D rect)
018    {
019        this();
020
021        final Rectangle3D rect3d = rect.toRectangle3D();
022
023        if (rect.isInfiniteT())
024            setSlice(-1, new ROI3DStackRectangle(rect3d));
025        else
026        {
027            for (int t = (int) Math.floor(rect.getMinT()); t < rect.getMaxT(); t++)
028                setSlice(t, new ROI3DStackRectangle(rect3d));
029        }
030    }
031}