0

CSI DM3 Reader ( http://code.google.com/p/cornell-spectrum-imager/wiki/Home ) を使用して .dm3 ファイルを読み取ります。これにドラッグ アンド ドロップ機能を追加したいので、ファイル HandleExtraFileTypes.java ( http://rsbweb.nih.gov/ij/plugins/download/HandleExtraFileTypes.java ) を変更し、101 行目で .dm3 関連付けを変更しました。 - から103

    if (name.endsWith(".dm3") && buf[0]==0 && buf[1]==0 && buf[2]==0 && buf[3]==3) {
        return tryPlugIn("DM3_Reader", path);
    }

    if (name.endsWith(".dm3") && buf[0]==0 && buf[1]==0 && buf[2]==0 && buf[3]==3) {
        return tryPlugIn("CSI_DM3_Reader", path);
    }

これにより、CSI DM3 リーダーと標準の DM3 リーダーの両方でファイルが開きます。CSI DM3 リーダーでのみ開くようにします。ImageJ が通常の DM3 リーダーを開かないようにするにはどうすればよいですか?

注 : tryPlugIn オブジェクトは次のとおりです。

/**
* Attempts to open the specified path with the given plugin. If the
* plugin extends the ImagePlus class (e.g., BioRad_Reader), set
* extendsImagePlus to true, otherwise (e.g., LSM_Reader) set it to false.
*
* @return A reference to the plugin, if it was successful.
*/
private Object tryPlugIn(String className, String path) {
    Object o = IJ.runPlugIn(className, path);
    if (o instanceof ImagePlus) {
        // plugin extends ImagePlus class
        ImagePlus imp = (ImagePlus)o;
            if (imp.getWidth()==0)
                o = null; // invalid image
            else
                width = IMAGE_OPENED; // success
    } else {
        // plugin does not extend ImagePlus; assume success
        width = IMAGE_OPENED;
    }
    return o;
}
4

0 に答える 0