Changeset 7677 for trunk/projects


Ignore:
Timestamp:
03/28/11 16:36:48 (9 years ago)
Author:
aivar
Message:

Fixed array out of bounds when grayscale image is zoomed and you click on it.

Location:
trunk/projects/slim-plugin/src/main/java/loci/slim
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/loci/slim/GrayScaleImage.java

    r7674 r7677  
    192192    } 
    193193 
     194    public float getZoomFactor() { 
     195        return m_stackWindow.getZoomFactor(); 
     196    } 
     197 
    194198    /** 
    195199     * Gets a grayscale pixel value, to test against a threshold. 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/IGrayScaleImage.java

    r7668 r7677  
    7878     */ 
    7979    public int getPixel(int channel, int x, int y); 
     80 
     81    /** 
     82     * Used to compensate X, Y position when clicking on zoomed image. 
     83     * 
     84     * @return 
     85     */ 
     86    public float getZoomFactor(); 
    8087} 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/MyStackWindow.java

    r7676 r7677  
    5353public class MyStackWindow extends StackWindow { 
    5454    private int m_slice = 1; 
     55    private int m_height; 
    5556 
    5657    public MyStackWindow(ImagePlus imp) { 
    5758        super(imp); 
     59        m_height = imp.getHeight(); 
    5860        if (null != sliceSelector) { 
    5961            sliceSelector.addAdjustmentListener( 
     
    8284        return m_slice; 
    8385    } 
     86 
     87    public float getZoomFactor() { 
     88        return (float) m_height / ic.getHeight(); 
     89    } 
    8490} 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/SLIMProcessor.java

    r7676 r7677  
    334334                    if (!m_fitInProgress) { 
    335335                        synchronized (m_synchFit) { 
     336                            float zoomFactor = ((GrayScaleImage)m_grayScaleImage).getZoomFactor(); 
     337                            x *= zoomFactor; 
     338                            y *= zoomFactor; 
    336339                            uiPanel.setX(x); 
    337340                            uiPanel.setY(y); 
Note: See TracChangeset for help on using the changeset viewer.