本文整理汇总了Java中ij.process.LUT类的典型用法代码示例。如果您正苦于以下问题:Java LUT类的具体用法?Java LUT怎么用?Java LUT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LUT类属于ij.process包,在下文中一共展示了LUT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: redgreen
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'redgreen' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT redgreen() {
byte[] r = new byte[256];
byte[] g = new byte[256];
byte[] b = new byte[256];
for (int i = 0; i < 128; i++) {
r[i] = (byte) (i * 2);
g[i] = (byte) 0;
b[i] = (byte) 0;
}
for (int i = 128; i < 256; i++) {
r[i] = (byte) 0;
g[i] = (byte) (i * 2);
b[i] = (byte) 0;
}
return new LUT(r, g, b);
}
示例2: revertInversion
import ij.process.LUT; //导入依赖的package包/类
@Deprecated
public static void revertInversion(final ImagePlus image) {
if (!image.isInvertedLut()) {
return;
}
if (image.isComposite()) {
final CompositeImage ci = (CompositeImage) image;
final LUT lut = ci.getChannelLut();
if (lut != null) ci.setChannelLut(lut.createInvertedLut());
return;
}
final ImageProcessor ip = image.getProcessor();
ip.invertLut();
if (image.getStackSize() > 1) {
image.getStack().setColorModel(ip.getColorModel());
}
}
示例3: getDefaultChannelColor
import ij.process.LUT; //导入依赖的package包/类
@Override
public Integer getDefaultChannelColor(int channel) {
if (isRGB()) {
return getDefaultRGBChannelColors(channel);
}
// Grayscale
if (nChannels() == 1)
return ColorTools.makeRGB(255, 255, 255);
if (imp instanceof CompositeImage) {
CompositeImage impComp = (CompositeImage)imp;
LUT lut = impComp.getChannelLut(channel+1);
int ind = lut.getMapSize()-1;
return lut.getRGB(ind);
}
return getDefaultChannelColor(channel);
}
示例4: transferChannelSettings
import ij.process.LUT; //导入依赖的package包/类
protected void transferChannelSettings( final CompositeImage ci, final SetupAssignments setupAssignments, final VisibilityAndGrouping visibility )
{
final int nChannels = ci.getNChannels();
final int mode = ci.getCompositeMode();
final boolean transferColor = mode == IJ.COMPOSITE || mode == IJ.COLOR;
for ( int c = 0; c < nChannels; ++c )
{
final LUT lut = ci.getChannelLut( c + 1 );
final ConverterSetup setup = setupAssignments.getConverterSetups().get( c );
if ( transferColor )
setup.setColor( new ARGBType( lut.getRGB( 255 ) ) );
setup.setDisplayRange( (int)lut.min, (int)lut.max );
}
if ( mode == IJ.COMPOSITE )
{
final boolean[] activeChannels = ci.getActiveChannels();
visibility.setDisplayMode( DisplayMode.FUSED );
for ( int i = 0; i < activeChannels.length; ++i )
visibility.setSourceActive( i, activeChannels[ i ] );
}
else
visibility.setDisplayMode( DisplayMode.SINGLE );
visibility.setCurrentSource( ci.getChannel() - 1 );
}
示例5: transferChannelSettings
import ij.process.LUT; //导入依赖的package包/类
protected void transferChannelSettings( final CompositeImage ci, final SetupAssignments setupAssignments, final VisibilityAndGrouping visibility )
{
final int nChannels = ci.getNChannels();
final int mode = ci.getCompositeMode();
final boolean transferColor = mode == IJ.COMPOSITE || mode == IJ.COLOR;
for ( int c = 0; c < nChannels; ++c )
{
final LUT lut = ci.getChannelLut( c + 1 );
final ConverterSetup setup = setupAssignments.getConverterSetups().get( c );
if ( transferColor )
setup.setColor( new ARGBType( lut.getRGB( 255 ) ) );
setup.setDisplayRange( lut.min, lut.max );
}
if ( mode == IJ.COMPOSITE )
{
final boolean[] activeChannels = ci.getActiveChannels();
visibility.setDisplayMode( DisplayMode.FUSED );
for ( int i = 0; i < activeChannels.length; ++i )
visibility.setSourceActive( i, activeChannels[ i ] );
}
else
visibility.setDisplayMode( DisplayMode.SINGLE );
visibility.setCurrentSource( ci.getChannel() - 1 );
}
示例6: createFireLUTBlackEnding
import ij.process.LUT; //导入依赖的package包/类
private LUT createFireLUTBlackEnding(double maxVal)
{
byte[] red = new byte[256];
byte[] green = new byte[256];
byte[] blue = new byte[256];
// initialize LUT with Fire colors
byte[][] lut = ColorMaps.createJetLut(255);
for (int i = 0; i < 255; i++)
{
red[i] = lut[i][0];
green[i] = lut[i][1];
blue[i] = lut[i][2];
}
// use black as last color (background)
red[255] = 0;
green[255] = 0;
blue[255] = 0;
// create color model
IndexColorModel cm = new IndexColorModel(8, 256, red, green, blue);
return new LUT(cm, 0, maxVal);
}
示例7: createFireLUT
import ij.process.LUT; //导入依赖的package包/类
/**
* Create fire look-up table
* @param maxVal maximum intensity value
* @return fire look-up table
*/
private LUT createFireLUT(double maxVal)
{
byte[][] lut = ColorMaps.createFireLut(256);
byte[] red = new byte[256];
byte[] green = new byte[256];
byte[] blue = new byte[256];
for (int i = 0; i < 256; i++)
{
red[i] = lut[i][0];
green[i] = lut[i][1];
blue[i] = lut[i][2];
}
IndexColorModel cm = new IndexColorModel(8, 256, red, green, blue);
return new LUT(cm, 0, maxVal);
}
示例8: fire
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'fire' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT fire() {
int[] r = { 0, 0, 1, 25, 49, 73, 98, 122, 146, 162, 173, 184, 195, 207, 217, 229, 240, 252,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] g = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 35, 57, 79, 101, 117, 133, 147, 161,
175, 190, 205, 219, 234, 248, 255, 255, 255, 255 };
int[] b = { 0, 61, 96, 130, 165, 192, 220, 227, 210, 181, 151, 122, 93, 64, 35, 5, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 35, 98, 160, 223, 255 };
return create(interpolateTo256(r), interpolateTo256(g), interpolateTo256(b));
}
示例9: grays
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'grays' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT grays() {
byte[] r = new byte[256];
byte[] g = new byte[256];
byte[] b = new byte[256];
for (int i = 0; i < r.length; i++) {
r[i] = (byte) i;
g[i] = (byte) i;
b[i] = (byte) i;
}
return create(r, g, b);
}
示例10: ice
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'ice' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT ice() {
int[] r = { 0, 0, 0, 0, 0, 0, 19, 29, 50, 48, 79, 112, 134, 158, 186, 201, 217, 229, 242, 250, 250, 250, 250,
251, 250, 250, 250, 250, 251, 251, 243, 230 };
int[] g = { 156, 165, 176, 184, 190, 196, 193, 184, 171, 162, 146, 125, 107, 93, 81, 87, 92, 97, 95, 93, 93, 90,
85, 69, 64, 54, 47, 35, 19, 0, 4, 0 };
int[] b = { 140, 147, 158, 166, 170, 176, 209, 220, 234, 225, 236, 246, 250, 251, 250, 250, 245, 230, 230, 222,
202, 180, 163, 142, 123, 114, 106, 94, 84, 64, 26, 27 };
return new LUT(interpolateTo256(r), interpolateTo256(g), interpolateTo256(b));
}
示例11: spectrum
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'spectrum' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT spectrum() {
byte[] r = new byte[256];
byte[] g = new byte[256];
byte[] b = new byte[256];
for (int i = 0; i < r.length; i++) {
Color c = Color.getHSBColor(i/255f, 1.0f, 1.0f);
r[i] = (byte) c.getRed();
g[i] = (byte) c.getGreen();
b[i] = (byte) c.getBlue();
}
return new LUT(r, g, b);
}
示例12: rgb332
import ij.process.LUT; //导入依赖的package包/类
/**
* ImageJ's 'rgb332' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
* @return A new instance of type {@link ij.process.LUT}.
*/
public static LUT rgb332() {
byte[] r = new byte[256];
byte[] g = new byte[256];
byte[] b = new byte[256];
for (int i = 0; i < r.length; i++) {
r[i] = (byte) (i & 0xE0);
g[i] = (byte) ((i << 3) & 0xE0);
b[i] = (byte) ((i << 6) & 0xC0);
}
return new LUT(r, g, b);
}
示例13: setupLuts
import ij.process.LUT; //导入依赖的package包/类
private void setupLuts() {
if(image.isComposite()) {
CompositeImage image2 = (CompositeImage) image;
LUT[] channeLuts = new LUT[zSlices];
if (colorizationLut == null) { // fallback if no LUTs are installed
for (int i = 0; i < channeLuts.length; i++) {
//Colormap for slices: (has constant grayscale intensity, unlike jet and similar)
//r: /
// __/
//g: /\
// / \
//b: \
// \__
float norm = (float) i / zSlices;
float r, g, b;
if (norm < 0.5) {
b = 1 - 2 * norm;
g = 2 * norm;
r = 0;
} else {
b = 0;
g = -2 * norm + 2;
r = 2 * norm - 1;
}
channeLuts[i] = LUT.createLutFromColor(new Color(r, g, b));
}
} else {
int[] rgb = new int[4];
for (int i = 0; i < channeLuts.length; i++) {
colorizationLut.getComponents((int)(((float) i / zSlices) * 255f), rgb, 0);
channeLuts[i] = LUT.createLutFromColor(new Color(rgb[0], rgb[1], rgb[2]));
}
}
image2.setLuts(channeLuts);
}
}
示例14: initialize
import ij.process.LUT; //导入依赖的package包/类
private void initialize() {
String path = IJ.getDirectory("luts");
List<File> files = IOUtils.listFilesInFolder(new File(path), false);
luts = new HashMap<String, LUT>();
for (File f : files) {
if (FilenameUtils.getExtension(f.getName()).toLowerCase().equals("lut")) {
String lutName = FilenameUtils.removeExtension(f.getName()).replace('_', ' ');
LUT lut = LutLoader.openLut(f.getAbsolutePath());
luts.put(lutName, lut);
model.addElement(lutName);
}
}
}
示例15: show
import ij.process.LUT; //导入依赖的package包/类
static void show(final Image img, final ImagePlus imp) {
ImagePlus newimp = img.imageplus();
newimp.setCalibration(imp.getCalibration());
final double[] minmax = img.extrema();
final double min = minmax[0], max = minmax[1];
newimp.setDisplayRange(min,max);
switch (type(imp)) {
case IMAGE5D: {
newimp = I5DResource.convert(newimp,true);
I5DResource.transfer(imp,newimp);
I5DResource.minmax(newimp,min,max);
I5DResource.mode(newimp,I5DResource.GRAY);
break;
}
case COMPOSITEIMAGE: {
final CompositeImage newcimp = new CompositeImage(newimp);
newcimp.copyLuts(imp);
newcimp.setMode(CompositeImage.GRAYSCALE);
final int nc = newcimp.getNChannels();
for (int c=1; c<=nc; ++c) {
final LUT lut = newcimp.getChannelLut(c);
lut.min = min; lut.max = max;
}
newimp = newcimp;
break;
}
case HYPERSTACK: {
newimp.setOpenAsHyperStack(true);
break;
}
}
newimp.changes = FJ_Options.save;
log("Showing result image");
newimp.show();
}