示例#1
0
  /** @noRefGuide */
  public int initialize() {
    super.initialize();

    // this may be different depending on the image
    m_channelsCount = 3;

    String vhash = getParamString(imageParams);

    Object co = ParamCache.getInstance().get(vhash);
    if (co == null) {
      long t0 = time();
      int res = prepareImage();

      printf("sizeX: %f\n", m_sizeX);
      printf("sizeY: %f\n", m_sizeY);
      printf("sizeZ: %f\n", m_sizeZ);
      printf("originX: %f\n", m_originX);
      printf("originY: %f\n", m_originY);
      printf("originZ: %f\n", m_originZ);
      printf("imageSizeX: %d\n", m_imageSizeX);
      printf("imageSizeY: %d\n", m_imageSizeY);

      printf("ImageColorMap.prepareImage() time: %d ms\n", (time() - t0));

      if (res != ResultCodes.RESULT_OK) {
        // something wrong with the image
        throw new IllegalArgumentException("undefined image");
      }

      ParamCache.getInstance().put(vhash, m_imageData);

    } else {
      m_imageData = (ImageColor) co;
    }

    Vector3d center = (Vector3d) mp_center.getValue();
    Vector3d size = (Vector3d) mp_size.getValue();
    m_originX = center.x - size.x / 2;
    m_originY = center.y - size.y / 2;
    m_originZ = center.z - size.z / 2;
    m_sizeX = size.x;
    m_sizeY = size.y;
    m_sizeZ = size.z;

    m_imageSizeX = m_imageData.getWidth();
    m_imageSizeY = m_imageData.getHeight();
    m_repeatX = mp_repeatX.getValue();
    m_repeatY = mp_repeatY.getValue();

    return ResultCodes.RESULT_OK;
  }
示例#2
0
  /**
   * Creates ImageColorMap from a file
   *
   * @param imageSource source of the image. Can be url, BufferedImage or ImageWrapper
   * @param sizex - width of the image
   * @param sizey - height of the image
   * @param sizez - depth of the image
   */
  public ImageColorMap(Object imageSource, double sizex, double sizey, double sizez) {

    super.addParams(m_aparams);

    mp_imageSource.setValue(imageSource);
    mp_size.setValue(new Vector3d(sizex, sizey, sizez));
  }
示例#3
0
 /** Get the size of the image box */
 public Vector3d getSize() {
   return mp_size.getValue();
 }
示例#4
0
 /**
  * Set size of the image box
  *
  * @param val The size in meters
  */
 public void setSize(Vector3d val) {
   mp_size.setValue(val);
 }
示例#5
0
 /** Get the center of the image box */
 public Vector3d getCenter() {
   return mp_center.getValue();
 }
示例#6
0
 /**
  * Set center of the image box
  *
  * @param val The center in meters
  */
 public void setCenter(Vector3d val) {
   mp_center.setValue(val);
 }