Class Grow


public class Grow
extends BoxAligner
Grow the bounding-box to fill larger as much as possible.

Depending on preserveAspectRatio, the aspect-ratio of smaller is preserved or not.

When preserveAspectRatio==false, the smaller bounding-box is guaranteed to become identical to the larger.

Growth never occurs in the z-dimension, and the size in this dimension should be equal for both smaller and larger.

  • Constructor Summary

    Constructors 
    Constructor Description
    Grow()  
    Grow​(boolean preserveAspectRatio)
    Create to preserve the aspect-ratio or not.
    Grow​(boolean preserveAspectRatio, Align align)  
  • Method Summary

    Modifier and Type Method Description
    protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.BoundingBox smaller, org.anchoranalysis.spatial.box.BoundingBox larger)
    Determines a BoundingBox to use for smaller BoundingBox so that it fits inside larger BoundingBox.
    protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.Extent smaller, org.anchoranalysis.spatial.box.BoundingBox larger)
    Determines a BoundingBox to use for smaller Extent so that it fits inside larger BoundingBox.
    protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.Extent smaller, org.anchoranalysis.spatial.box.Extent larger)
    Determines a BoundingBox to use for smaller Extent so that it fits inside larger Extent.
    Align getAlign()
    How to align the box after it is grown, as much as possible.
    boolean isPreserveAspectRatio()
    Whether to preserve the aspect-ratio of the smaller image when growing.
    void setAlign​(Align align)
    How to align the box after it is grown, as much as possible.
    void setPreserveAspectRatio​(boolean preserveAspectRatio)
    Whether to preserve the aspect-ratio of the smaller image when growing.

    Methods inherited from class org.anchoranalysis.image.bean.spatial.arrange.align.BoxAligner

    align, align, align

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Grow

      public Grow​(boolean preserveAspectRatio)
      Create to preserve the aspect-ratio or not.
      Parameters:
      preserveAspectRatio - whether to preserve the aspect-ratio of the smaller image when growing.
    • Grow

      public Grow()
    • Grow

      public Grow​(boolean preserveAspectRatio, Align align)
  • Method Details

    • alignAfterCheck

      protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.BoundingBox smaller, org.anchoranalysis.spatial.box.BoundingBox larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller BoundingBox so that it fits inside larger BoundingBox.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • alignAfterCheck

      protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.Extent smaller, org.anchoranalysis.spatial.box.Extent larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller Extent so that it fits inside larger Extent.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • alignAfterCheck

      protected org.anchoranalysis.spatial.box.BoundingBox alignAfterCheck​(org.anchoranalysis.spatial.box.Extent smaller, org.anchoranalysis.spatial.box.BoundingBox larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller Extent so that it fits inside larger BoundingBox.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • isPreserveAspectRatio

      public boolean isPreserveAspectRatio()
      Whether to preserve the aspect-ratio of the smaller image when growing.
    • setPreserveAspectRatio

      public void setPreserveAspectRatio​(boolean preserveAspectRatio)
      Whether to preserve the aspect-ratio of the smaller image when growing.
    • getAlign

      public Align getAlign()
      How to align the box after it is grown, as much as possible.
    • setAlign

      public void setAlign​(Align align)
      How to align the box after it is grown, as much as possible.