@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));
  }
 @Override
 protected void paint(ImageListViewCellPaintEvent e) {
   getControlledImageListView()
       .getBackend()
       .printTextIntoCell(
           e,
           getTextToPrint(e.getSource()),
           (int) getTextPosition().getX(),
           (int) getTextPosition().getY(),
           textColor);
 }
  @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);
  }
  @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());
  }