use of loci.plugins.util.ImageProcessorReader in project bioformats by openmicroscopy.
the class ImagePlusReader method createVirtualStack.
private ImageStack createVirtualStack(ImportProcess process, int s, List<LUT> luts) throws FormatException, IOException {
final ImporterOptions options = process.getOptions();
final ImageProcessorReader reader = process.getReader();
reader.setSeries(s);
final int zCount = process.getZCount(s);
final int cCount = process.getCCount(s);
final int tCount = process.getTCount(s);
final IMetadata meta = process.getOMEMetadata();
final int imageCount = reader.getImageCount();
// CTR FIXME: Make virtual stack work with different color modes?
final BFVirtualStack virtualStack = new BFVirtualStack(options.getId(), reader, false, false, false);
for (int i = 0; i < imageCount; i++) {
String label = constructSliceLabel(i, reader, meta, s, zCount, cCount, tCount);
virtualStack.addSlice(label);
}
if (luts != null) {
for (int c = 0; c < cCount; c++) {
int index = reader.getIndex(0, c, 0);
ImageProcessor ip = reader.openProcessors(index)[0];
final ColorModel cm = ip.getColorModel();
final LUT lut = cm instanceof LUT ? (LUT) cm : null;
luts.add(lut);
}
}
return virtualStack;
}
use of loci.plugins.util.ImageProcessorReader in project bioformats by openmicroscopy.
the class ColorDialog method constructDialog.
@Override
protected GenericDialog constructDialog() {
GenericDialog gd = new GenericDialog("Bio-Formats Custom Colorization");
// CTR FIXME - avoid problem with MAX_SLIDERS in GenericDialog
final ImageProcessorReader reader = process.getReader();
final List<Panel> swatches = new ArrayList<Panel>();
for (int s = 0; s < process.getSeriesCount(); s++) {
if (!options.isSeriesOn(s))
continue;
reader.setSeries(s);
for (int c = 0; c < reader.getSizeC(); c++) {
Color color = options.getCustomColor(s, c);
if (color == null)
color = options.getDefaultCustomColor(c);
gd.addSlider(makeLabel("Red:", s, c), 0, 255, color.getRed());
gd.addSlider(makeLabel("Green:", s, c), 0, 255, color.getGreen());
gd.addSlider(makeLabel("Blue:", s, c), 0, 255, color.getBlue());
Panel swatch = createSwatch(color);
gd.addPanel(swatch, GridBagConstraints.CENTER, new Insets(5, 0, 5, 0));
swatches.add(swatch);
}
}
// change swatch colors when sliders move
List<TextField> colorFields = getNumericFields(gd);
attachListeners(colorFields, swatches);
WindowTools.addScrollBars(gd);
return gd;
}
use of loci.plugins.util.ImageProcessorReader in project bioformats by openmicroscopy.
the class ColorDialog method harvestResults.
@Override
protected boolean harvestResults(GenericDialog gd) {
final ImageProcessorReader reader = process.getReader();
for (int s = 0; s < process.getSeriesCount(); s++) {
if (!options.isSeriesOn(s))
continue;
reader.setSeries(s);
for (int c = 0; c < reader.getSizeC(); c++) {
int red = (int) gd.getNextNumber();
int green = (int) gd.getNextNumber();
int blue = (int) gd.getNextNumber();
Color color = new Color(red, green, blue);
options.setCustomColor(s, c, color);
}
}
return true;
}
use of loci.plugins.util.ImageProcessorReader in project bioformats by openmicroscopy.
the class ImportProcess method initializeStack.
/**
* Performed following ImportStep.STACK notification.
*/
private void initializeStack() throws FormatException, IOException {
IFormatReader r = baseReader;
if (options.isGroupFiles()) {
r = fileStitcher = new FileStitcher(baseReader);
// overwrite base filename with file pattern
String id = options.getId();
fileStitcher.setId(id);
fileStitcher.setUsingPatternIds(true);
fileStitcher.setCanChangePattern(false);
}
r.setId(options.getId());
if (options.isGroupFiles()) {
options.setId(fileStitcher.getFilePattern().getPattern());
}
final byte[][] lut8 = r.get8BitLookupTable();
final int sizeC = r.getSizeC();
r = channelFiller = new ChannelFiller(r);
if (channelFiller.isFilled()) {
BF.warn(options.isQuiet(), getIdName() + ": index values will be lost");
}
r = channelSeparator = new ChannelSeparator(r);
r = dimensionSwapper = new DimensionSwapper(r);
if (options.isAutoscale() || FormatTools.isFloatingPoint(r)) {
r = minMaxCalculator = new MinMaxCalculator(r);
}
if (options.doStitchTiles()) {
r = tileStitcher = new TileStitcher(r);
}
r = virtualReader = new VirtualReader(r);
reader = new ImageProcessorReader(r);
if (options != null && !options.showROIs()) {
baseReader.getMetadataOptions().setMetadataLevel(MetadataLevel.NO_OVERLAYS);
}
setId();
computeSeriesLabels(reader);
}
use of loci.plugins.util.ImageProcessorReader in project bioformats by openmicroscopy.
the class SwapDialog method constructDialog.
@Override
protected GenericDialog constructDialog() {
ImageProcessorReader reader = process.getReader();
int seriesCount = process.getSeriesCount();
GenericDialog gd = new GenericDialog("Dimension swapping options");
String[] labels = { "Z", "C", "T" };
for (int s = 0; s < seriesCount; s++) {
if (!options.isSeriesOn(s))
continue;
reader.setSeries(s);
String[] sizes = new String[] { String.valueOf(reader.getSizeZ()), String.valueOf(reader.getSizeC()), String.valueOf(reader.getSizeT()) };
gd.addMessage("Series " + (s + 1) + ":\n");
for (int i = 0; i < labels.length; i++) {
gd.addChoice(labels[i] + "_" + (s + 1), sizes, sizes[i]);
}
}
List<Choice> choices = WindowTools.getChoices(gd);
zChoice = choices.get(0);
cChoice = choices.get(1);
tChoice = choices.get(2);
zChoice.addItemListener(this);
cChoice.addItemListener(this);
tChoice.addItemListener(this);
WindowTools.addScrollBars(gd);
return gd;
}
Aggregations