ICY Version 1.0.1.0

Tutorial: How to use some math operation over full array, regardless of the type.

 public class SimpleIntensify extends Plugin implements PluginImageAnalysis
{
    @Override
    public void compute()
    {
        // get focused image
        IcyBufferedImage image = getFocusedImage();

        // check if the image exists
        if (image == null)
        {
            MessageDialog.showDialog("This plugin need a valid opened image.", MessageDialog.WARNING_MESSAGE);
            return;
        }

        // display what this tutorial perform.
        new AnnounceFrame("This tutorial multiply image intensity by a factor of 2, regardless the image data type.");

        // get first component image data as double[] whatever is the base data type
        double[] data = ArrayUtil.arrayToDoubleArray1D(image.getDataXY(0), image.isSignedDataType());

        // multiply by a factor of 2
        MathUtil.mul(data, 2d);

        // write back data by taking care of destination type limitation
        ArrayUtil.doubleArrayToSafeArray1D(data, image.getDataXY(0), image.isSignedDataType());

        // notify data changed
        image.dataChanged();
    }
}

This plugin do a simple intensify operation on current opened image

Author:
Stephane & Fabrice
 All Classes Functions Variables