Changeset 6584


Ignore:
Timestamp:
06/29/10 08:43:24 (9 years ago)
Author:
curtis
Message:

Backport recent bugfixes to 4.2 branch.

Location:
branches/4.2
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

  • branches/4.2/ant/common.xml

    r6032 r6584  
    3131  </target> 
    3232 
    33   <target name="init-svn"> 
    34     <!-- determine SVN and version statistics --> 
     33  <target name="init-version"> 
     34    <!-- check for SVN versioning information --> 
    3535    <property name="svn.path" value="${basedir}/.svn/entries"/> 
    3636    <available file="${svn.path}" property="svn.present"/> 
     
    3939      <then> 
    4040        <loadfile property="svn.entries" srcFile="${svn.path}"/> 
     41        <propertyregex property="svn.revision" input="${svn.entries}" 
     42          regexp="([^\n]*\n){3}([^\n]*)" select="\2"/> 
     43        <propertyregex property="svn.url" input="${svn.entries}" 
     44          regexp="([^\n]*\n){4}([^\n]*)" select="\2"/> 
     45        <propertyregex property="svn.root" input="${svn.entries}" 
     46          regexp="([^\n]*\n){5}([^\n]*)" select="\2"/> 
     47        <propertyregex property="svn.date" input="${svn.entries}" 
     48          regexp="([^\n]*\n){9}([^\n]*)" select="\2"/> 
     49        <propertyregex property="svn.changed" input="${svn.entries}" 
     50          regexp="([^\n]*\n){10}([^\n]*)" select="\2"/> 
     51      </then> 
     52    </if> 
    4153 
    42         <propertyregex property="svn.revision" 
    43           input="${svn.entries}" regexp="([^\n]*\n){3}([^\n]*)" select="\2"/> 
     54    <!-- check for Git versioning information --> 
     55    <property name="git.path" value="${root.dir}/.git"/> 
     56    <available file="${git.path}" property="git.present"/> 
     57    <if> 
     58      <isset property="git.present"/> 
     59      <then> 
     60        <exec executable="git" outputproperty="git.info" 
     61          failifexecutionfails="false"> 
     62          <arg value="show"/> 
     63          <arg value="-s"/> 
     64          <arg value="HEAD"/> 
     65        </exec> 
     66        <propertyregex property="git.commit" input="${git.info}" 
     67          regexp="commit ([a-f0-9]+)" select="\1"/> 
     68        <propertyregex property="svn.revision" input="${git.info}" 
     69          regexp=".*git-svn-id: [^@]+@([0-9]+)" select="\1"/> 
     70        <propertyregex property="svn.url" 
     71          input="${git.info}" regexp=".*git-svn-id: ([^@]+)" select="\1"/> 
     72        <propertyregex property="svn.root" input="${svn.url}" 
     73          regexp="(.*)(/trunk)|(/branches)|(/tags).*" select="\1"/> 
     74        <propertyregex property="svn.date" 
     75          input="${git.info}" regexp="Date: +([^\n]*)" select="\1"/> 
     76        <property name="svn.changed" value="unknown"/> 
     77      </then> 
     78    </if> 
    4479 
    45         <propertyregex property="svn.url" 
    46           input="${svn.entries}" regexp="([^\n]*\n){4}([^\n]*)" select="\2"/> 
    47  
    48         <propertyregex property="svn.root" 
    49           input="${svn.entries}" regexp="([^\n]*\n){5}([^\n]*)" select="\2"/> 
    50  
    51         <propertyregex property="svn.date" 
    52           input="${svn.entries}" regexp="([^\n]*\n){9}([^\n]*)" select="\2"/> 
    53  
    54         <propertyregex property="svn.changed" 
    55           input="${svn.entries}" regexp="([^\n]*\n){10}([^\n]*)" select="\2"/> 
    56  
    57         <propertyregex property="release.version" defaultValue="trunk" 
     80    <!-- set release version from repository URL --> 
     81    <property name="release.version" value="unknown"/> 
     82    <if> 
     83      <isset property="svn.url"/> 
     84      <then> 
     85        <propertyregex property="release.version" override="true" 
     86          input="${svn.url}" regexp=".*/(trunk).*" replace="\1"/> 
     87        <propertyregex property="release.version" override="true" 
    5888          input="${svn.url}" regexp=".*/branches/([^/]*).*" 
    5989          replace="dev \1"/> 
  • branches/4.2/ant/global.xml

    r6026 r6584  
    106106    </if> 
    107107    <if> 
    108       <isset property="svn.revision"/> 
     108      <isset property="release.version"/> 
    109109      <then> 
    110110        <echo> 
    111111=========== VERSIONING PROPERTIES =========== 
    112         svn.revision = ${svn.revision} 
    113              svn.url = ${svn.url} 
    114             svn.root = ${svn.root} 
    115             svn.date = ${svn.date} 
    116          svn.changed = ${svn.changed} 
    117      release.version = ${release.version}</echo> 
     112         release.version = ${release.version}</echo> 
     113        <if> 
     114          <isset property="svn.revision"/> 
     115          <then> 
     116            <echo>            svn.revision = ${svn.revision} 
     117                 svn.url = ${svn.url} 
     118                svn.root = ${svn.root} 
     119                svn.date = ${svn.date} 
     120             svn.changed = ${svn.changed}</echo> 
     121          </then> 
     122        </if> 
     123        <if> 
     124          <isset property="git.commit"/> 
     125          <then> 
     126            <echo>              git.commit = ${git.commit}</echo> 
     127          </then> 
     128        </if> 
    118129      </then> 
    119130    </if> 
  • branches/4.2/ant/java.xml

    r6026 r6584  
    169169 
    170170  <target name="init" 
    171     depends="init-title, init-timestamp, init-svn, init-manifest-cp"/> 
     171    depends="init-title, init-timestamp, init-version, init-manifest-cp"/> 
    172172 
    173173  <target name="init-manifest-cp"> 
  • branches/4.2/components

  • branches/4.2/components/bio-formats/src

  • branches/4.2/components/bio-formats/src/loci/formats/ChannelFiller.java

  • branches/4.2/components/bio-formats/src/loci/formats/IFormatReader.java

    r6514 r6584  
    130130   * Returns false if {@link #isIndexed()} is false, or if {@link #isIndexed()} 
    131131   * is true and the lookup table represents "real" color data. Returns true 
    132    * if {@link #isIndexed} is true and the lookup table is only present to aid 
     132   * if {@link #isIndexed()} is true and the lookup table is only present to aid 
    133133   * in visualization. 
    134134   */ 
  • branches/4.2/components/bio-formats/src/loci/formats/ImageTools.java

  • branches/4.2/components/bio-formats/src/loci/formats/in/FakeReader.java

  • branches/4.2/components/loci-plugins

  • branches/4.2/components/loci-plugins/src/loci/plugins

  • branches/4.2/components/loci-plugins/src/loci/plugins/in/Colorizer.java

    r6559 r6584  
    3737 
    3838import loci.formats.ChannelFiller; 
     39import loci.formats.DimensionSwapper; 
     40import loci.formats.FormatTools; 
    3941import loci.formats.ImageReader; 
    4042import loci.plugins.BF; 
     
    6769    final ImporterOptions options = process.getOptions(); 
    6870    final ImageProcessorReader reader = process.getReader(); 
     71    final DimensionSwapper dimSwapper = process.getDimensionSwapper(); 
    6972    final ChannelFiller channelFiller = process.getChannelFiller(); 
    7073    final ImageReader imageReader = process.getImageReader(); 
     
    8083      // get each channel's color model 
    8184      final ImageStack stack = imp.getStack(); 
    82       final int sizeC = reader.getEffectiveSizeC(); 
    83       final LUT[] channelLUTs = new LUT[sizeC]; 
     85      final String stackOrder = dimSwapper.getDimensionOrder(); 
     86      final int zSize = imp.getNSlices(); 
     87      final int cSize = imp.getNChannels(); 
     88      final int tSize = imp.getNFrames(); 
     89      final int stackSize = imp.getStackSize(); 
     90      final LUT[] channelLUTs = new LUT[cSize]; 
    8491      boolean hasChannelLUT = false; 
    85       for (int c=0; c<sizeC; c++) { 
    86         final int index = reader.getIndex(0, c, 0) + 1; 
     92      for (int c=0; c<cSize; c++) { 
     93        final int index = FormatTools.getIndex(stackOrder, 
     94          zSize, cSize, tSize, stackSize, 0, c, 0) + 1; 
    8795        final ColorModel cm = stack.getProcessor(index).getColorModel(); 
    8896 
     
    140148      } 
    141149 
    142       final boolean doComposite = mode != -1 && sizeC > 1 && sizeC <= 7; 
     150      final boolean doComposite = mode != -1 && cSize > 1 && cSize <= 7; 
    143151      if (doComposite) { 
    144152        CompositeImage compImage = new CompositeImage(imp, mode); 
     
    151159          imp.getProcessor().setColorModel(luts[0]); 
    152160        } 
    153         if (mode != -1 && sizeC > 1) { 
     161        if (mode != -1 && cSize > 1) { 
    154162          // NB: Cannot use CompositeImage with more than seven channels. 
    155163          BF.warn(options.isQuiet(), "Data has too many channels for " + 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/Concatenator.java

    r6495 r6584  
    3939 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/loci-plugins/src/loci/plugins/in/Concatenator.java">SVN</a></dd></dl> 
    4040 * 
     41 * @author Curtis Rueden ctrueden at wisc.edu 
    4142 * @author Melissa Linkert melissa at glencoesoftware.com 
    4243 */ 
     
    4647  public List<ImagePlus> concatenate(List<ImagePlus> imps) { 
    4748 
    48     List<Integer> widths = new ArrayList<Integer>(); 
    49     List<Integer> heights = new ArrayList<Integer>(); 
    50     List<Integer> types = new ArrayList<Integer>(); 
    51     List<ImagePlus> newImps = new ArrayList<ImagePlus>(); 
     49    // list of output (possibly concatenated) images 
     50    final List<ImagePlus> outputImps = new ArrayList<ImagePlus>(); 
    5251 
    53     for (int j=0; j<imps.size(); j++) { 
    54       ImagePlus imp = imps.get(j); 
    55       int wj = imp.getWidth(); 
    56       int hj = imp.getHeight(); 
    57       int tj = imp.getBitDepth(); 
     52    for (ImagePlus imp : imps) { 
     53      final int width = imp.getWidth(); 
     54      final int height = imp.getHeight(); 
     55      final int type = imp.getType(); 
     56      final int cSize = imp.getNChannels(); 
     57      final int zSize = imp.getNSlices(); 
     58      final int tSize = imp.getNFrames(); 
     59 
    5860      boolean append = false; 
    59       for (int k=0; k<widths.size(); k++) { 
    60         int wk = widths.get(k); 
    61         int hk = heights.get(k); 
    62         int tk = types.get(k); 
     61      for (int k=0; k<outputImps.size(); k++) { 
     62        final ImagePlus outputImp = outputImps.get(k); 
     63        final int w = outputImp.getWidth(); 
     64        final int h = outputImp.getHeight(); 
     65        final int outType = outputImp.getType(); 
     66        final int c = outputImp.getNChannels(); 
     67        final int z = outputImp.getNSlices(); 
     68        final int t = outputImp.getNFrames(); 
    6369 
    64         if (wj == wk && hj == hk && tj == tk) { 
    65           ImagePlus oldImp = newImps.get(k); 
    66           ImageStack is = oldImp.getStack(); 
    67           ImageStack newStack = imp.getStack(); 
    68           for (int s=0; s<newStack.getSize(); s++) { 
    69             is.addSlice(newStack.getSliceLabel(s + 1), 
    70               newStack.getProcessor(s + 1)); 
    71           } 
    72           oldImp.setStack(oldImp.getTitle(), is); 
    73           newImps.set(k, oldImp); 
    74           append = true; 
    75           k = widths.size(); 
     70        // verify that images are compatible 
     71        if (width != w || height != h) continue; // different XY resolution 
     72        if (type != outType) continue; // different processor type 
     73        final boolean canAppendT = cSize == c && zSize == z; 
     74        final boolean canAppendZ = cSize == c && tSize == t; 
     75        final boolean canAppendC = zSize == z && tSize == t; 
     76        if (!canAppendT && !canAppendZ && !canAppendC) { 
     77          // incompatible dimensions 
     78          continue; 
    7679        } 
     80 
     81        // concatenate planes onto this output image 
     82        final ImageStack outputStack = outputImp.getStack(); 
     83        final ImageStack inputStack = imp.getStack(); 
     84        for (int s=0; s<inputStack.getSize(); s++) { 
     85          outputStack.addSlice(inputStack.getSliceLabel(s + 1), 
     86            inputStack.getProcessor(s + 1)); 
     87        } 
     88        outputImp.setStack(outputImp.getTitle(), outputStack); 
     89 
     90        // update image dimensions 
     91        // NB: For now, we prioritize adding to the time points, then 
     92        // focal planes, and lastly channels. In some cases, there may be 
     93        // multiple compatible dimensions; in the future, we may prompt the 
     94        // user to choose the axis for concatenation. 
     95        if (canAppendT) outputImp.setDimensions(c, z, t + tSize); 
     96        else if (canAppendZ) outputImp.setDimensions(c, z + zSize, t); 
     97        else if (canAppendC) outputImp.setDimensions(c + cSize, z, t); 
     98        else throw new IllegalStateException("Dimensional mismatch"); 
     99 
     100        append = true; 
     101        break;         
    77102      } 
    78103      if (!append) { 
    79         widths.add(new Integer(wj)); 
    80         heights.add(new Integer(hj)); 
    81         types.add(new Integer(tj)); 
    82         newImps.add(imp); 
     104        // could not concatenate input image to any existing output; 
     105        // append it to the list of outputs directly instead 
     106        outputImps.add(imp); 
    83107      } 
    84108    } 
    85109 
    86     return newImps; 
     110    return outputImps; 
    87111  } 
    88112 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6564 r6584  
    4444import loci.formats.FileStitcher; 
    4545import loci.formats.FormatException; 
    46 import loci.formats.FormatTools; 
    4746import loci.formats.IFormatReader; 
    4847import loci.formats.ImageReader; 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/importer-options.txt

    r6341 r6584  
    4444  <br><br>Possible choices are:<ul>                                      \ 
    4545  <li><b>Default</b> - Display channels as closely as possible           \ 
    46   to how they are stored in the file. For 8-bit indexed color,           \ 
    47   this is the only choice that will preserve the index values.</li>      \ 
     46  to how they are stored in the file.</li>                               \ 
    4847  <li><b>Composite</b> - Open as a merged composite image. Channels are  \ 
    4948  colorized according to metadata present in the dataset (if any),       \ 
     
    5958  </ul>                                                                  \ 
    6059  Note that ImageJ can only composite together 7 or fewer channels.      \ 
    61   With more than 7 channels, Bio-Formats will ask how to split them up.  \ 
    62   For example, a 12-channel dataset could be partitioned as:<ul>         \ 
    63   <li>6 planes with 2 channels each</li>                                 \ 
    64   <li>4 planes with 3 channels each</li>                                 \ 
    65   <li>3 planes with 4 channels each</li>                                 \ 
    66   <li>3 planes with 5 channels each</li>                                 \ 
    67   <li>2 planes with 6 channels each</li>                                 \ 
    68   <li>2 planes with 7 channels each</li>                                 \ 
    69   </ul> 
     60  With more than 7 channels, some of the modes above may not work. 
    7061default = Default 
    7162values = \ 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/ImagePlusTools.java

    r6555 r6584  
    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.