Class MatrixDisplay<R,​C>

    • Field Detail

      • m_columnLabelHeight

        protected int m_columnLabelHeight
      • m_fontGutter

        protected int m_fontGutter
      • m_fontSize

        protected int m_fontSize
      • m_isShowLabels

        protected boolean m_isShowLabels
      • m_isShowScale

        protected boolean m_isShowScale
      • m_labelFont

        protected Font m_labelFont
      • m_labelGutter

        protected int m_labelGutter
      • m_maxColumnLength

        protected int m_maxColumnLength
      • m_ratioWidth

        protected int m_ratioWidth
      • m_resolution

        protected int m_resolution
      • m_rowLabelWidth

        protected int m_rowLabelWidth
      • m_textSize

        protected int m_textSize
    • Constructor Detail

      • MatrixDisplay

        public MatrixDisplay​(ColorMatrix<R,​C> matrix)
      • MatrixDisplay

        public MatrixDisplay​(DoubleMatrix<R,​C> matrix)
    • Method Detail

      • getColor

        public Color getColor​(int row,
                              int column)
      • getColorMap

        public Color[] getColorMap()
        Returns:
        the current color map
      • getColumnCount

        public int getColumnCount()
      • getColumnName

        public Object getColumnName​(int column)
      • getColumnNames

        public String[] getColumnNames()
      • getDisplayMax

        public double getDisplayMax()
      • getDisplayMin

        public double getDisplayMin()
      • getDisplayRange

        public double getDisplayRange()
      • getMax

        public double getMax()
        Returns:
        the largest value in the matrix
      • getMaxColumnLength

        public int getMaxColumnLength()
        Returns:
        the m_maxColumnLength
      • getMin

        public double getMin()
        Returns:
        the smallest value in the matrix
      • getMissingColor

        public Color getMissingColor()
        Returns:
        the color used for missing values
      • getRawValue

        public double getRawValue​(int row,
                                  int column)
      • getRow

        public double[] getRow​(int row)
      • getRowByName

        public double[] getRowByName​(R rowName)
      • getRowCount

        public int getRowCount()
      • getRowHeight

        public int getRowHeight()
      • getRowIndexByName

        public int getRowIndexByName​(R rowName)
      • getRowName

        public Object getRowName​(int row)
      • getRowNames

        public String[] getRowNames()
      • getStandardizedEnabled

        public boolean getStandardizedEnabled()
      • getValue

        public double getValue​(int row,
                               int column)
      • resetRowKeys

        public void resetRowKeys()
      • saveImage

        public void saveImage​(ColorMatrix<R,​C> matrix,
                              String outPngFilename,
                              boolean showLabels,
                              boolean showScalebar,
                              boolean standardize)
                       throws IOException
        Parameters:
        outPngFilename - String
        showLabels - boolean
        standardize - normalize to deviation 1, mean 0. FIXME this is not used?
        Throws:
        IOException
      • saveImage

        public void saveImage​(String outPngFilename)
                       throws IOException
        Saves the image to a png file.
        Parameters:
        outPngFilename - String
        Throws:
        IOException
      • saveImage

        public void saveImage​(String outPngFilename,
                              boolean showLabels,
                              boolean showScale)
                       throws IOException
        Parameters:
        outPngFilename -
        showLabels -
        Throws:
        IOException
      • saveImageToPng

        public void saveImageToPng​(ColorMatrix<R,​C> matrix,
                                   OutputStream stream,
                                   boolean showLabels,
                                   boolean showScalebar,
                                   boolean standardize)
                            throws IOException
        Parameters:
        stream -
        showLabels -
        standardize -
        Throws:
        IOException
      • setCellSize

        public void setCellSize​(Dimension d)
      • setColorMap

        public void setColorMap​(Color[] colorMap)
        Parameters:
        colorMap - an array of colors which define the midpoints in the color map; this can be one of the constants defined in the ColorMap class, like ColorMap.REDGREEN_COLORMAP and ColorMap.BLACKBODY_COLORMAP
      • setDisplayRange

        public void setDisplayRange​(double min,
                                    double max)
        Parameters:
        min -
        max -
      • setLabelsVisible

        public void setLabelsVisible​(boolean isShowLabels)
        If this display component has already been added to the GUI, it will be resized to fit or exclude the row names
        Parameters:
        isShowLabels - boolean
      • setMatrix

        public void setMatrix​(ColorMatrix<R,​C> matrix)
        Parameters:
        matrix - the new matrix to use; will resize this display component as necessary
      • setMaxColumnLength

        public void setMaxColumnLength​(int columnLength)
        Parameters:
        columnLength - the m_maxColumnLength to set
      • setRowHeight

        public void setRowHeight​(int height)
      • setRowKeys

        public void setRowKeys​(int[] rowKeys)
      • setScaleBarVisible

        public void setScaleBarVisible​(boolean isShowScale)
      • setStandardizedEnabled

        public void setStandardizedEnabled​(boolean showStandardizedMatrix)
      • computeSize

        protected Dimension computeSize​(boolean showLabels,
                                        boolean showScalebar)
        compute the size of the matrix in pixels.
        Parameters:
        withLabels -
        Returns:
      • drawColumnNames

        protected void drawColumnNames​(Graphics g,
                                       boolean leaveRoomForScalebar)
        Draws column names vertically (turned 90 degrees counter-clockwise)
        Parameters:
        g - Graphics
      • drawMatrix

        protected void drawMatrix​(ColorMatrix<R,​C> matrix,
                                  Graphics g,
                                  boolean leaveRoomForLabels,
                                  boolean leaveRoomForScalebar)
        Gets called from #paintComponent and #saveImage. Does not draw the labels.
        Parameters:
        g - Graphics
        leaveRoomForLabels - boolean
      • drawRowNames

        protected void drawRowNames​(Graphics g,
                                    boolean showScalebar)
        Draws row names (horizontally)
        Parameters:
        g - Graphics
        showScalebar -
      • drawScaleBar

        protected void drawScaleBar​(Graphics g,
                                    Dimension d,
                                    double displayMin,
                                    double displayMax)
        Parameters:
        g -
        d -
      • initSize

        protected void initSize()
        Sets the display size