Changeset 6575


Ignore:
Timestamp:
06/28/10 12:30:24 (9 years ago)
Author:
curtis
Message:

Disable calibration function for INT32, since FloatProcessor is used.
Also remove some old, commented code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/src/loci/plugins/util/ImagePlusTools.java

    r6554 r6575  
    2626package loci.plugins.util; 
    2727 
    28 import ij.CompositeImage; 
    2928import ij.ImagePlus; 
    3029import ij.ImageStack; 
    3130import ij.measure.Calibration; 
    32 import ij.process.ByteProcessor; 
    3331import ij.process.ColorProcessor; 
    34 import ij.process.FloatProcessor; 
    3532import ij.process.ImageProcessor; 
    36 import ij.process.ShortProcessor; 
    3733 
    3834import java.io.IOException; 
     
    5753 
    5854  // -- Utility methods -- 
    59  
    60   /** 
    61    * Converts the given array of ImageProcessors into a single-slice 
    62    * RGB ImagePlus. 
    63    */ 
    64 /* FIXME remove makeRGB methods 
    65   public static ImagePlus makeRGB(ImageProcessor[] p) { 
    66     return makeRGB("", p); 
    67   } 
    68 */ 
    69  
    70   /** 
    71    * Converts the given array of ImageProcessors into a single-slice 
    72    * RGB ImagePlus. 
    73    */ 
    74 /* FIXME remove makeRGB methods 
    75   public static ImagePlus makeRGB(String title, ImageProcessor[] p) { 
    76     if (p.length == 1) return new ImagePlus(title, p[0]); 
    77  
    78     // check that all processors are of the same type and size 
    79     boolean sameType = true; 
    80     int width = p[0].getWidth(); 
    81     int height = p[0].getHeight(); 
    82     boolean byteProc = p[0] instanceof ByteProcessor; 
    83     boolean shortProc = p[0] instanceof ShortProcessor; 
    84     boolean floatProc = p[0] instanceof FloatProcessor; 
    85     for (int i=1; i<p.length; i++) { 
    86       int w = p[i].getWidth(); 
    87       int h = p[i].getHeight(); 
    88       boolean b = p[i] instanceof ByteProcessor; 
    89       boolean s = p[i] instanceof ShortProcessor; 
    90       boolean f = p[i] instanceof FloatProcessor; 
    91       if (w != width || h != height || b != byteProc || s != shortProc || 
    92         f != floatProc) 
    93       { 
    94         sameType = false; 
    95         break; 
    96       } 
    97     } 
    98  
    99     if (!sameType || p.length > 4 || p[0] instanceof ColorProcessor) { 
    100       return null; 
    101     } 
    102  
    103     ImagePlus imp = null; 
    104  
    105     if (p.length < 4 && byteProc) { 
    106       ColorProcessor cp = new ColorProcessor(width, height); 
    107       byte[][] bytes = new byte[p.length][]; 
    108       for (int i=0; i<p.length; i++) { 
    109         bytes[i] = (byte[]) p[i].getPixels(); 
    110       } 
    111       cp.setRGB(bytes[0], bytes[1], bytes.length == 3 ? bytes[2] : 
    112         new byte[width * height]); 
    113       imp = new ImagePlus(title, cp); 
    114     } 
    115     else if (p.length <= 7) { 
    116       ImageStack tmpStack = new ImageStack(width, height); 
    117       for (int i=0; i<p.length; i++) tmpStack.addSlice("", p[i]); 
    118  
    119       ImagePlus ii = new ImagePlus(title, tmpStack); 
    120       imp = new CompositeImage(ii, CompositeImage.COMPOSITE); 
    121     } 
    122  
    123     return imp; 
    124   } 
    125 */ 
    12655 
    12756  /** Applies spatial calibrations to an image stack. */ 
     
    16897    int pixelType = FormatTools.pixelTypeFromString(type); 
    16998 
     99    // NB: INT32 is represented with FloatProcessor, so no need to calibrate. 
    170100    boolean signed = pixelType == FormatTools.INT8 || 
    171       pixelType == FormatTools.INT16 || pixelType == FormatTools.INT32; 
     101      pixelType == FormatTools.INT16; // || pixelType == FormatTools.INT32; 
    172102 
    173103    // set calibration function, so that both signed and unsigned pixel 
Note: See TracChangeset for help on using the changeset viewer.