Script

Rename Sequence Metadata

Publication ID: ICY-M7Z3K6

Short Description

Sometimes, images metadata contains the same name, and thus are confusing for the user (two very different sequences with the same name). This changes the name in the metadata to the file name.

Versions

  • Version 1 • Released on: 2013-03-11 11:56:10
    Download
    Description:

    initial version

    importClass(Packages.icy.file.Loader)
    importClass(Packages.plugins.tprovoost.scripteditor.uitools.filedialogs.FileDialog)
    importClass(Packages.java.io.File)
    
    importClass(Packages.icy.file.Saver)
    importClass(Packages.loci.formats.ome.OMEXMLMetadataImpl)
    importClass(Packages.icy.sequence.Sequence)
    importClass(Packages.icy.main.Icy)
    
    f = FileDialog.open()
    
    if (f == null) throw "No file"
    
    seq = Loader.loadSequence(f)
    
    s = f.getName()
    
    // get the metadata
    meta = seq.getMetadata()
    
    // iterate over the images
    for (i = 0; i < meta.getImageCount(); ++i) {
            meta.setImageName(s, i)
    }
    
    seq.setName(s)
    
    // Auto-Save
    multipleFiles = false;
    Saver.save(seq, f, multipleFiles)
    
    // Load the sequence
    Loader.load(f)

Leave a Review