use of net.imglib2.display.ColorTable in project imagej-ui-swing by imagej.
the class SwingImageDisplayPanel method updateColorBar.
private void updateColorBar(final int c) {
final DatasetView view = imageDisplayService.getActiveDatasetView(display);
// no active dataset
if (view == null)
return;
List<ColorTable> colorTables = view.getColorTables();
if (c >= colorTables.size())
return;
final ColorTable lut = colorTables.get(c);
colorBar.setColorTable(lut);
colorBar.repaint();
}
use of net.imglib2.display.ColorTable in project imagej-ui-swing by imagej.
the class SwingColorTableWidget method doRefresh.
// -- AbstractUIInputWidget methods ---
@Override
public void doRefresh() {
ColorTable colorTable = getValue();
fillImage(colorTable);
picLabel.setIcon(new ImageIcon(image));
picLabel.repaint();
}
use of net.imglib2.display.ColorTable in project imagej-ui-swing by imagej.
the class SwingColorBar method main.
// -- Main method --
public static void main(final String[] args) {
final ColorTable[] luts = { ColorTables.FIRE, ColorTables.ICE, ColorTables.SPECTRUM, ColorTables.RED, ColorTables.GREEN, ColorTables.BLUE, ColorTables.CYAN, ColorTables.MAGENTA, ColorTables.YELLOW, ColorTables.GRAYS, ColorTables.REDGREEN, ColorTables.RGB332 };
final JFrame frame = new JFrame();
frame.setTitle("LUTs");
final JPanel pane = new JPanel();
frame.setContentPane(pane);
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
for (final ColorTable lut : luts) {
final SwingColorBar colorBar = new SwingColorBar(lut);
colorBar.setBorder(new LineBorder(Color.black));
pane.add(colorBar);
}
frame.pack();
frame.setVisible(true);
}
use of net.imglib2.display.ColorTable in project imagej-plugins-commands by imagej.
the class FlipAxis method swapColorTables.
// NB - this is one approach to swapping color tables. Ideally when the
// metadata branch is merged Axes can be tagged with color tables and Views
// will automatically return the right one. Then we can use the setImg() of
// the inverted view of the axis and color tables will auto remap.
private void swapColorTables() {
if (axisType == Axes.X || axisType == Axes.Y)
return;
long numPlanes = numPlanes(dataset);
if (dataset.getColorTableCount() != numPlanes)
return;
for (int i = 0; i < (numPlanes / 2) - 1; i++) {
int partner = findPartner(i);
if (partner != i) {
ColorTable table = dataset.getColorTable(i);
dataset.setColorTable(dataset.getColorTable(partner), i);
dataset.setColorTable(table, partner);
}
}
}
use of net.imglib2.display.ColorTable in project imagej-plugins-commands by imagej.
the class ReorderAxis method newData.
private ImgPlus<? extends RealType<?>> newData() {
DatasetView view = imageDisplayService.getActiveDatasetView(display);
ColorTable[] origTable = origViewTables(view);
double[] origMin = origDisplayMins(view);
double[] origMax = origDisplayMaxes(view);
Dataset newData = dataset.duplicate();
int[] positions = newPositions();
int tableCount = dataset.getColorTableCount();
for (int i = 0; i < positions.length; i++) {
copyHypersliceData(axisNum, dataset, positions[i], newData, i);
if (channelsCase) {
// set dataset color table
ColorTable table = dataset.getColorTable(positions[i]);
if (i < tableCount)
newData.setColorTable(table, i);
// set view color table
view.setColorTable(origTable[positions[i]], i);
// set display range
view.setChannelRange(i, origMin[positions[i]], origMax[positions[i]]);
}
}
return newData.getImgPlus();
}
Aggregations