| Chunk |
|---|
| Conflicting content |
|---|
package imagej.core.commands.display; <<<<<<< HEAD:core/commands/display/src/main/java/imagej/core/commands/display/ShowLUT.java import imagej.command.ContextCommand; ======= import java.util.List; >>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1:core/plugins/display/src/main/java/imagej/core/plugins/display/ShowLUT.java import imagej.data.ChannelCollection; import imagej.data.Dataset; import imagej.data.DatasetService; |
| Solution content |
|---|
package imagej.core.commands.display; import imagej.command.ContextCommand; import imagej.data.ChannelCollection; import imagej.data.Dataset; import imagej.data.DatasetService; |
| File |
|---|
| ShowLUT.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import imagej.data.display.DatasetView; import imagej.data.display.ImageDisplay; import imagej.data.display.ImageDisplayService; <<<<<<< HEAD:core/commands/display/src/main/java/imagej/core/commands/display/ShowLUT.java import imagej.menu.MenuConstants; import imagej.module.ItemIO; import imagej.plugin.Menu; import imagej.plugin.Parameter; import imagej.plugin.Plugin; import imagej.render.RenderingService; import imagej.render.TextRenderer.TextJustification; ======= import imagej.ext.menu.MenuConstants; import imagej.ext.module.ItemIO; import imagej.ext.plugin.Menu; import imagej.ext.plugin.Parameter; import imagej.ext.plugin.Plugin; import imagej.ext.plugin.RunnablePlugin; >>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1:core/plugins/display/src/main/java/imagej/core/plugins/display/ShowLUT.java import imagej.util.ColorRGB; import imagej.util.Colors; |
| Solution content |
|---|
import imagej.data.display.DatasetView; import imagej.data.display.ImageDisplay; import imagej.data.display.ImageDisplayService; import imagej.menu.MenuConstants; import imagej.module.ItemIO; import imagej.plugin.Menu; import imagej.plugin.Parameter; import imagej.plugin.Plugin; import imagej.render.RenderingService; import imagej.render.TextRenderer.TextJustification; import imagej.util.ColorRGB; import imagej.util.Colors; |
| File |
|---|
| ShowLUT.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
return ds;
}
<<<<<<< HEAD:core/commands/display/src/main/java/imagej/core/commands/display/ShowLUT.java
private void drawLutInfo(Dataset ds, ColorTable8 lut) {
DrawingTool tool = new DrawingTool(ds, renderingService);
=======
private void drawLutInfo(Dataset ds, ColorTable ct) {
DrawingTool tool = new DrawingTool(ds);
>>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1:core/plugins/display/src/main/java/imagej/core/plugins/display/ShowLUT.java
int xMargin = 35;
int yMargin = 20;
int width = 256; |
| Solution content |
|---|
return ds;
}
private void drawLutInfo(Dataset ds, ColorTable ct) {
DrawingTool tool = new DrawingTool(ds, renderingService);
int xMargin = 35;
int yMargin = 20;
int width = 256; |
| File |
|---|
| ShowLUT.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
package imagej.data.display; <<<<<<< HEAD import imagej.util.ColorRGB; ======= import java.awt.Color; import net.imglib2.display.AbstractColorTable; >>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1 import net.imglib2.display.ColorTable; import net.imglib2.display.ColorTable8; |
| Solution content |
|---|
package imagej.data.display; import imagej.util.ColorRGB; import net.imglib2.display.ColorTable; import net.imglib2.display.ColorTable8; |
| File |
|---|
| ColorTables.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
}
if (mode == ColorMode.COMPOSITE) {
double rSum = 0, gSum = 0, bSum = 0;
for (int c = 0; c < channelCount; c++) {
<<<<<<< HEAD
final double value = channels.getChannelValue(c);
final RealLUTConverter extends RealType>> converter =
converters.get(c);
final double min = converter.getMin();
final double max = converter.getMax();
double relativeValue = (value - min) / (max - min);
if (relativeValue < 0) relativeValue = 0;
if (relativeValue > 1) relativeValue = 1;
final int grayValue = (int) (relativeValue * 255);
final ColorTable8 colorTable = converter.getLUT();
rSum += colorTable.get(0, grayValue);
gSum += colorTable.get(1, grayValue);
bSum += colorTable.get(2, grayValue);
=======
double value = channels.getChannelValue(c);
RealLUTConverter extends RealType>> converter = converters.get(c);
double min = converter.getMin();
double max = converter.getMax();
int grayValue = Binning.valueToBin(256, min, max, value);
ColorTable colorTable = converter.getLUT();
rSum += colorTable.getResampled(ColorTable.RED, 256, grayValue);
gSum += colorTable.getResampled(ColorTable.GREEN, 256, grayValue);
bSum += colorTable.getResampled(ColorTable.BLUE, 256, grayValue);
>>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1
r = (rSum > 255) ? 255 : (int) Math.round(rSum);
g = (gSum > 255) ? 255 : (int) Math.round(gSum); |
| Solution content |
|---|
if (mode == ColorMode.COMPOSITE) {
double rSum = 0, gSum = 0, bSum = 0;
for (int c = 0; c < channelCount; c++) {
final double value = channels.getChannelValue(c);
final RealLUTConverter extends RealType>> converter =
converters.get(c);
final double min = converter.getMin();
final double max = converter.getMax();
final int grayValue = Binning.valueToBin(256, min, max, value);
final ColorTable colorTable = converter.getLUT();
rSum += colorTable.getResampled(ColorTable.RED, 256, grayValue);
gSum += colorTable.getResampled(ColorTable.GREEN, 256, grayValue);
bSum += colorTable.getResampled(ColorTable.BLUE, 256, grayValue);
}
r = (rSum > 255) ? 255 : (int) Math.round(rSum);
g = (gSum > 255) ? 255 : (int) Math.round(gSum); |
| File |
|---|
| DefaultDatasetView.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Cast expression |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
b = (bSum > 255) ? 255 : (int) Math.round(bSum);
}
else { // grayscale or color
<<<<<<< HEAD
final long currChannel = getLongPosition(Axes.CHANNEL);
final double value = channels.getChannelValue(currChannel);
final RealLUTConverter extends RealType>> converter =
converters.get((int) currChannel);
final double min = converter.getMin();
final double max = converter.getMax();
double relativeValue = (value - min) / (max - min);
if (relativeValue < 0) relativeValue = 0;
if (relativeValue > 1) relativeValue = 1;
final int grayValue = (int) Math.round(relativeValue * 255);
if (mode == ColorMode.COLOR) {
final ColorTable8 colorTable = converter.getLUT();
r = colorTable.get(0, grayValue);
g = colorTable.get(1, grayValue);
b = colorTable.get(2, grayValue);
=======
long currChannel = getLongPosition(Axes.CHANNEL);
double value = channels.getChannelValue(currChannel);
RealLUTConverter extends RealType>> converter =
converters.get((int) currChannel);
double min = converter.getMin();
double max = converter.getMax();
int grayValue = Binning.valueToBin(256, min, max, value);
if (mode == ColorMode.COLOR) {
ColorTable colorTable = converter.getLUT();
r = colorTable.getResampled(ColorTable.RED, 256, grayValue);
g = colorTable.getResampled(ColorTable.GREEN, 256, grayValue);
b = colorTable.getResampled(ColorTable.BLUE, 256, grayValue);
>>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1
}
else { // mode == grayscale
r = grayValue; |
| Solution content |
|---|
b = (bSum > 255) ? 255 : (int) Math.round(bSum);
}
else { // grayscale or color
final long currChannel = getLongPosition(Axes.CHANNEL);
final double value = channels.getChannelValue(currChannel);
final RealLUTConverter extends RealType>> converter =
converters.get((int) currChannel);
final double min = converter.getMin();
final double max = converter.getMax();
final int grayValue = Binning.valueToBin(256, min, max, value);
if (mode == ColorMode.COLOR) {
final ColorTable colorTable = converter.getLUT();
r = colorTable.getResampled(ColorTable.RED, 256, grayValue);
g = colorTable.getResampled(ColorTable.GREEN, 256, grayValue);
b = colorTable.getResampled(ColorTable.BLUE, 256, grayValue);
}
else { // mode == grayscale
r = grayValue; |
| File |
|---|
| DefaultDatasetView.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Cast expression |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
import imagej.data.display.ImageDisplay;
import imagej.service.Service;
<<<<<<< HEAD
=======
import imagej.util.RealRect;
import java.util.ArrayList;
import java.util.List;
import net.imglib2.RandomAccess;
import net.imglib2.display.ColorTable;
import net.imglib2.display.ColorTable16;
import net.imglib2.display.ColorTable8;
import net.imglib2.display.RealLUTConverter;
import net.imglib2.meta.Axes;
import net.imglib2.meta.AxisType;
import net.imglib2.type.numeric.RealType;
//TODO
//1) Maintain metadata
//2) maintain overlays: does an overlay in Z == 7 show up on correct slice
// in output data?
//3) report parse error string somehow
//5) test the contains(num) code works
//TODO - multiple places I'm relying on a Display's axes rather than a
//Dataset's axes. See if there are problems with this
//TODO - the iterators work with Lists which can only hold 2 gig or fewer
//elements. Thus data cannot be copied > 2 gig per dimension.
//TODO:
//-- for speed eliminate reliance on Longs. Make primitive arrays.
//-- make a EnormousList that can store more than 2 gig of longs
//In other plugins replace RestructureUtils calls with methods from here
//Note when user specifies 1-1000 I am storing them all consecutively (i.e.
// 1,2,3,4,5...1000. For small amounts this is fine but might want something
// more sophisticated for large dimensional ranges.
>>>>>>> 4669b3785cc2b24740d9cd9172e1a24ae6a6a6e1
/**
* Interface for sampler operations which manipulate {@link ImageDisplay} data. |
| Solution content |
|---|
import imagej.data.display.ImageDisplay;
import imagej.service.Service;
/**
* Interface for sampler operations which manipulate {@link ImageDisplay} data. |
| File |
|---|
| SamplerService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*/
* Creates a copy of all the planes bounded by the currently selected 2d
* region of an ImageDisplay.
*/
<<<<<<< HEAD
ImageDisplay duplicateSelectedPlanes(ImageDisplay display);
=======
public ImageDisplay duplicateSelectedPlanes(final ImageDisplay display) {
final SamplingDefinition copyDef =
SamplingDefinition.sampleAllPlanes(display);
final RealRect selection = overlayService.getSelectionBounds(display);
final long minX = (long) selection.x;
final long minY = (long) selection.y;
final long maxX = (long) (selection.x + selection.width);
final long maxY = (long) (selection.y + selection.height);
final AxisSubrange xSubrange = new AxisSubrange(minX, maxX);
final AxisSubrange ySubrange = new AxisSubrange(minY, maxY);
copyDef.constrain(Axes.X, xSubrange);
copyDef.constrain(Axes.Y, ySubrange);
return createSampledImage(copyDef);
}
// -- private helpers --
/**
* Creates an output image from a sampling definition. All data initialized to
* zero.
*/
private ImageDisplay createOutputImage(final SamplingDefinition def) {
final ImageDisplay origDisp = def.getDisplay();
// TODO - remove evil cast
final Dataset origDs = (Dataset) origDisp.getActiveView().getData();
final long[] dims = def.getOutputDims();
final String name = origDisp.getName();
final AxisType[] axes = def.getOutputAxes();
final double[] cal = def.getOutputCalibration(axes);
final int bitsPerPixel = origDs.getType().getBitsPerPixel();
final boolean signed = origDs.isSigned();
final boolean floating = !origDs.isInteger();
final Dataset output =
datasetService.create(dims, name, axes, bitsPerPixel, signed, floating);
output.setCalibration(cal);
long numPlanes = calcNumPlanes(dims, axes);
if (numPlanes > Integer.MAX_VALUE) {
throw new IllegalArgumentException(
"output image has more planes than "+Integer.MAX_VALUE);
}
output.getImgPlus().initializeColorTables((int)numPlanes);
if (origDs.isRGBMerged()) {
final int chanAxis = output.getAxisIndex(Axes.CHANNEL);
if (chanAxis >= 0) {
if (output.dimension(chanAxis) == 3) {
output.setRGBMerged(true);
}
}
}
// TODO - remove evil cast
return (ImageDisplay) displayService.createDisplay(name, output);
}
/** Copies all associated data from a SamplingDefinition to an output image. */
private void copyData(final SamplingDefinition def,
final ImageDisplay outputImage)
{
final PositionIterator iter1 = new SparsePositionIterator(def);
final PositionIterator iter2 = new DensePositionIterator(def);
// TODO - remove evil casts
final Dataset input = (Dataset) def.getDisplay().getActiveView().getData();
final Dataset output = (Dataset) outputImage.getActiveView().getData();
final long[] inputDims = input.getDims();
final long[] outputDims = output.getDims();
final RandomAccess extends RealType>> inputAccessor =
input.getImgPlus().randomAccess();
final RandomAccess extends RealType>> outputAccessor =
output.getImgPlus().randomAccess();
double min = Double.MAX_VALUE;
double max = -Double.MAX_VALUE;
while (iter1.hasNext() && iter2.hasNext()) {
// determine data positions within datasets
final long[] inputPos = iter1.next();
final long[] outputPos = iter2.next();
inputAccessor.setPosition(inputPos);
outputAccessor.setPosition(outputPos);
// copy value
final double value = inputAccessor.get().getRealDouble();
min = Math.min(value, min);
max = Math.max(value, max);
outputAccessor.get().setReal(value);
// TODO - notice there is a lot of inefficiency following here.
// We are setting color tables once per pixel in image and do a lot of
// calculation to figure out what table. This should be done once per
// plane.
// keep dataset color tables in sync
final int inputPlaneNumber = planeNum(inputDims, inputPos);
final ColorTable colorTable = input.getColorTable(inputPlaneNumber);
final int outputPlaneNumber = planeNum(outputDims, outputPos);
output.setColorTable(colorTable, outputPlaneNumber);
}
// TODO - enable this code
// List |
| Solution content |
|---|
* Creates a copy of all the planes bounded by the currently selected 2d * region of an ImageDisplay. */ ImageDisplay duplicateSelectedPlanes(ImageDisplay display); } |
| File |
|---|
| SamplerService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Method interface |