Changes between Version 11 and Version 12 of PluginMenu


Ignore:
Timestamp:
Mar 8, 2013, 12:01:03 PM (12 years ago)
Author:
marie
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PluginMenu

    v11 v12  
    88'''Writing Batchable and Plugin classes'''
    99
    10 MorphAnalyser handles two plugin interfaces. The first, Batchable3D, allows single and batch processing of 3D images. A no-args constructor (or no constructor for the no args default) needs to be provided for loading at runtime (using java reflection). Most of the work should be done in the process method, which will be used to process each ObjectGeometry (as listed in a standard text list file, with one .obj per line). Other methods required include an initialisation method, 3 methods to indicate if the template should be read or written, and if the object geometry should be written.
     10MorphAnalyser handles two plugin interfaces. The first, Batchable3D, allows single and batch processing of 3D images. A no-args constructor (or no constructor for the no args default) needs to be provided for loading at runtime (using java reflection). Most of the work should be done in the process method, which will be used to process each ObjectGeometry (as listed in a standard text list file, with one .obj per line). Other methods required include an initialisation method, 3 methods to indicate if the template should be read or written, and if the object geometry should be written.  A finish method is used for any clean up, and a getName method is used to retrieve the name displayed on the menu. A simple example of a Batchable3D that crops to a plane is given below:
     11
     12{{{
     13public class BatchCropPlugin3D implements  Batchable3D {
     14   MorphAnalyser2 morphanalyser;
     15
     16   public boolean process(ObjectGeometry obj, Template3D t3d, boolean single) {
     17       float[] plane = morphanalyser.getPlane();
     18       obj.trimToPlane2(plane);
     19       return true;
     20   }
     21
     22    public boolean initialise(MorphAnalyser2 morphanalyser) {
     23        this.morphanalyser = morphanalyser;
     24        return true;
     25    }
     26
     27    public void finish() {}
     28 
     29    public String getName() {return "Crop";}
     30
     31    public boolean getReadTemplate3D() {return false;}
     32
     33    public boolean getWriteTemplate3D() {return false;}
     34
     35    public boolean getWriteObjectGeometry() {return true;}
     36
     37}
     38}}}
    1139
    1240The second interface, Plugin3D, is more general, and simply supports a setup and cleanup method.