Changeset 7890 for trunk/projects


Ignore:
Timestamp:
02/15/12 14:10:13 (8 years ago)
Author:
kbriney
Message:

Fixed validation errors in UUID assignment. Fixed indexing in "FirstC", "FirstT", and "FirstZ" variables so they start at 0, as specified by the OME-XML schema. Also made it easier for testing by immediately overwriting the args[] input to specify a particular test file. This code does not yet produce OME-XML that validates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/prairie-ome-tiff/src/main/java/loci/apps/prairie/PrairieInjector.java

    r7885 r7890  
    5050import ome.xml.model.primitives.NonNegativeInteger; 
    5151 
     52 
    5253/** 
    5354 * Command line tool to inject OME-XML into Prairie TIFF files. 
     
    6364 
    6465  public static void main(String[] args) throws Exception { 
     66args = new String[] { "C:\\Users\\Kristin\\Documents\\Dropbox\\LOCI\\TestingFiles\\15Feb2012\\Test1\\TIFF-001_Cycle001_CurrentSettings_Ch1_000001.tif" }; 
    6567//    System.setProperty("plugins.dir", "C:\\Program Files (x86)\\ImageJ\\plugins"); 
    6668//    new ImageJ(); 
     
    100102    reader.setMetadataStore(meta); 
    101103 
     104    //String[] myargs={"C:\\Users\\Kristin\\Documents\\Dropbox\\LOCI\\TestingFiles\\8Feb2012\\TIFF-001_Cycle001_CurrentSettings_Ch1_000001.tif"}; 
     105     
    102106    // parse the Prairie dataset, populating the metadata store 
    103107    // does not read actual image planes 
     
    127131        continue; 
    128132      } 
    129       int t = Integer.parseInt(m.group(1)); 
    130       int c = Integer.parseInt(m.group(2)); 
    131       int z = Integer.parseInt(m.group(3)); 
     133      int t = Integer.parseInt(m.group(1)) - 1; 
     134      int c = Integer.parseInt(m.group(2)) - 1; 
     135      int z = Integer.parseInt(m.group(3)) - 1; 
    132136 
    133137      meta.setTiffDataFirstC(new NonNegativeInteger(c), 0, tiffDataIndex); 
     
    135139      meta.setTiffDataFirstT(new NonNegativeInteger(t), 0, tiffDataIndex); 
    136140      meta.setUUIDFileName(file, 0, tiffDataIndex); 
    137       String uuid = UUID.randomUUID().toString(); 
     141      String uuid = "urn:uuid:" + UUID.randomUUID().toString(); 
    138142      meta.setUUIDValue(uuid, 0, tiffDataIndex); 
    139143      uuids.put(file, uuid); 
     
    149153      // write out the XML to the TIFF 
    150154      String xml = omexmlService.getOMEXML(meta); 
    151       XMLTools.validateXML(xml); // TEMPORARY to make sure it is correct 
     155      //XMLTools.validateXML(xml);                                                      // TEMPORARY to make sure it is correct 
    152156      RandomAccessInputStream in = new RandomAccessInputStream(file); 
    153157      TiffSaver tiffSaver = new TiffSaver(file); 
Note: See TracChangeset for help on using the changeset viewer.