Rectangle2D rect = new Rectangle2D.Double(0, 0, dispImg.width() * image.getRescaleX(), dispImg.height() * image.getRescaleY()); addRectangle(layer, rect, axial ? Color.RED : sagittal ? Color.BLUE : Color.GREEN);
throw new IIOException("Cannot read an image!"); //$NON-NLS-1$ if (MathUtil.isDifferent(dcm.getRescaleX(), dcm.getRescaleY())) { Dimension dim = new Dimension((int) (Math.abs(dcm.getRescaleX()) * image.width()), (int) (Math.abs(dcm.getRescaleY()) * image.height())); image = ImageProcessor.scale(image.toImageCV(), dim, Imgproc.INTER_LINEAR);
double ratiox = img.getRescaleX(); double ratioy = img.getRescaleY(); area.setFrameFromDiagonal(getDisplayLength(tlhc[0], ratiox), getDisplayLength(tlhc[1], ratioy),
public GeometryOfSlice getDispSliceGeometry() { // The geometry is adapted to get square pixel as all the images are displayed with square pixel. double[] imgOr = TagD.getTagValue(this, Tag.ImageOrientationPatient, double[].class); if (imgOr != null && imgOr.length == 6) { double[] pos = TagD.getTagValue(this, Tag.ImagePositionPatient, double[].class); if (pos != null && pos.length == 3) { Double sliceTickness = TagD.getTagValue(this, Tag.SliceThickness, Double.class); if (sliceTickness == null) { sliceTickness = getPixelSize(); } double[] spacing = { getPixelSize(), getPixelSize(), sliceTickness }; Integer rows = TagD.getTagValue(this, Tag.Rows, Integer.class); Integer columns = TagD.getTagValue(this, Tag.Columns, Integer.class); if (rows != null && columns != null && rows > 0 && columns > 0) { // SliceTickness is only use in IntersectVolume // Multiply rows and columns by getZoomScale() to have square pixel image size return new GeometryOfSlice(new double[] { imgOr[0], imgOr[1], imgOr[2] }, new double[] { imgOr[3], imgOr[4], imgOr[5] }, pos, spacing, sliceTickness, new double[] { rows * getRescaleY(), columns * getRescaleX(), 1 }); } } } return null; }
if (MathUtil.isDifferent(img.getRescaleX(), img.getRescaleY())) {