Пример #1
0
  @Override
  public void paintCellROIs(ImageListViewCellPaintEvent evt) {
    ImageListViewCell cell = evt.getSource();
    Graphics2D g2d = (Graphics2D) evt.getGc().getGraphics2D().create();
    Graphics2D userGraphics = (Graphics2D) g2d.create();
    Point2D imageOffset = getImageOffset(cell);

    userGraphics.transform(
        AffineTransform.getTranslateInstance(imageOffset.getX(), imageOffset.getY()));
    cell.getRoiDrawingViewer().paint(new GC(userGraphics));
  }
Пример #2
0
 @Override
 public void paintMeasurementIntoCell(
     ImageListViewCellPaintEvent evt, Point2D p1, Point2D p2, String text, Color textColor) {
   Graphics2D g2d = evt.getGc().getGraphics2D();
   g2d.setColor(textColor);
   g2d.draw(new Line2D.Double(p1, p2));
   g2d.drawString(text, (int) (p1.getX() + p2.getX()) / 2, (int) (p1.getY() + p2.getY()) / 2);
 }
Пример #3
0
  @Override
  public void paintCellImage(ImageListViewCellPaintEvent e) {
    ImageListViewCell cell = e.getSource();
    Graphics2D g2d = (Graphics2D) e.getGc().getGraphics2D().create();

    // give the render* methods a Graphics2D whose coordinate system
    // (and eventually, clipping) is already relative to the area in
    // which the image should be drawn
    Graphics2D userGraphics = (Graphics2D) g2d.create();
    Point2D imageOffset = getImageOffset(cell);
    userGraphics.transform(
        AffineTransform.getTranslateInstance(imageOffset.getX(), imageOffset.getY()));

    // render the image
    BufferedImageOp scaleImageOp =
        new AffineTransformOp(getDicomToUiTransform(cell), AffineTransformOp.TYPE_BILINEAR);
    userGraphics.drawImage(getWindowedImage(cell), scaleImageOp, 0, 0);
  }
Пример #4
0
  @Override
  public void printLUTIntoCell(
      ImageListViewCellPaintEvent e,
      int lutWidth,
      int lutHeight,
      int intervals,
      Point2D lutPosition,
      Point2D textPosition,
      Color textColor,
      List<String> scaleList) {
    ImageListViewCell cell = e.getSource();
    LookupTable lut = cell.getLookupTable();
    Graphics2D g2d = (Graphics2D) e.getGc().getGraphics2D().create();

    Graphics2D userGraphics = (Graphics2D) g2d.create();

    // draw lut values
    g2d.setColor(textColor);
    int posx = (int) textPosition.getX();
    int posy = (int) textPosition.getY() - 5;
    int lineHeight = lutHeight / intervals;

    for (String scale : scaleList) {
      g2d.drawString(scale, posx - scale.length() * 10, posy);
      posy += lineHeight;
    }
    // draw lut legend
    BufferedImage lutImage =
        scaleImage(
            rotateImage(LutController.getLutMap().get(lut.getName()).getBimg()),
            lutWidth,
            lutHeight);

    // create bordered image
    BufferedImage borderedImage =
        new BufferedImage(lutImage.getWidth() + 2, lutImage.getHeight() + 2, lutImage.getType());
    Graphics2D graphic = borderedImage.createGraphics();
    graphic.setColor(Color.GRAY);
    graphic.fillRect(0, 0, borderedImage.getWidth(), borderedImage.getHeight());
    graphic.drawImage(lutImage, 1, 1, null);

    userGraphics.drawImage(borderedImage, null, (int) lutPosition.getX(), (int) lutPosition.getY());
  }
Пример #5
0
 @Override
 public void printTextIntoCell(
     ImageListViewCellPaintEvent evt, String[] text, int textX, int textY, Color textColor) {
   Graphics2D g2d = (Graphics2D) evt.getGc().getGraphics2D().create();
   g2d.setColor(textColor);
   int lineHeight = g2d.getFontMetrics().getHeight();
   for (String line : text) {
     g2d.drawString(line, textX, textY);
     textY += lineHeight;
   }
 }
 @Override
 protected void paint(ImageListViewCellPaintEvent e) {
   getControlledImageListView()
       .getBackend()
       .printTextIntoCell(
           e,
           getTextToPrint(e.getSource()),
           (int) getTextPosition().getX(),
           (int) getTextPosition().getY(),
           textColor);
 }