This commit is contained in:
Andre Meyering 2018-11-05 19:52:09 +01:00
parent d66cf81292
commit 2f0ef234e7
34 changed files with 169160 additions and 15 deletions

5
Code/README.txt Normal file
View file

@ -0,0 +1,5 @@
# Code für Plugins
Den Ordner "plugins" kopieren nach "ImageJ.app"
Die Java Klasse muss in einer Datei mit dem gleichen Namen liegen. Auch muss die Datei in einem Ordner mit dem gleichen Namen liegen.

View file

@ -0,0 +1,69 @@
import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;
import java.util.*;
/**
* This is a template for a plugin that requires one image to
* be opened, and takes it as parameter.
*/
public class Gamma_2018_10_24 implements PlugInFilter {
protected ImagePlus image;
/**
* This method gets called by ImageJ / Fiji to determine
* whether the current image is of an appropriate type.
*
* @param arg can be specified in plugins.config
* @param image is the currently opened image
* @see ij.plugin.filter.PlugInFilter#setup(java.lang.String, ij.ImagePlus)
*/
@Override
public int setup(String arg, ImagePlus image) {
this.image = image;
/*
* The current return value accepts all gray-scale
* images (if you access the pixels with ip.getf(x, y)
* anyway, that works quite well.
*
* It could also be DOES_ALL; you can add "| NO_CHANGES"
* to indicate that the current image will not be
* changed by this plugin.
*
* Beware of DOES_STACKS: this will call the run()
* method with all slices of the current image
* (channels, z-slices and frames, all). Most likely
* not what you want.
*/
return DOES_8G | DOES_16 | DOES_32;
}
/**
* This method is run when the current image was accepted.
*
* @param ip is the current slice (typically, plugins use
* the ImagePlus set above instead).
* @see ij.plugin.filter.PlugInFilter#run(ij.process.ImageProcessor)
*/
@Override
public void run(ImageProcessor ip) {
int k = 256;
int aMax = k -1;
double gamma = 2.8;
// bauen uns eine LUT (Look-Up-Table)
int[] lut = new int[k];
for (int a = 0; a < k; ++a) {
double aa = ((double) a) / aMax;
double bb = Math.pow(aa, gamma);
int b = (int) Math.round(bb*aMax);
lut[a] = b;
}
ip.applyTable(lut);
}
}

1
Code/plugins/readme.txt Normal file
View file

@ -0,0 +1 @@
User plugins go here.