bdv.viewer.DisplayMode Java Examples

The following examples show how to use bdv.viewer.DisplayMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BDVRenderingState.java    From 3Dscript with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public BDVRenderingState(
		int frame,
		DisplayMode displaymode,
		int timepoint,
		Interpolation interpolation,
		int currentSource,
		CombinedTransform fwdTransform,
		Color[] channelColors,
		double[] channelMin,
		double[] channelMax) {
	this(frame, fwdTransform, channelColors.length);
	nonChannelProperties[DISPLAY_MODE]   = displaymode.ordinal();
	nonChannelProperties[TIMEPOINT]      = timepoint;
	nonChannelProperties[INTERPOLATION]  = interpolation.ordinal();
	nonChannelProperties[CURRENT_SOURCE] = currentSource;
	for(int c = 0; c < channelColors.length; c++) {
		Color cC = channelColors[c];
		channelProperties[c][INTENSITY_MIN]       = channelMin[c];
		channelProperties[c][INTENSITY_MAX]       = channelMax[c];
		channelProperties[c][CHANNEL_COLOR_RED]   = cC.getRed();
		channelProperties[c][CHANNEL_COLOR_GREEN] = cC.getGreen();
		channelProperties[c][CHANNEL_COLOR_BLUE]  = cC.getBlue();
	}
}
 
Example #2
Source File: BDVRenderer.java    From 3Dscript with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
}
 
Example #3
Source File: StitchingExplorerPanel.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
public static void setFusedModeSimple(final BigDataViewer bdv, final AbstractSpimData< ? > data)
{
	if ( bdv == null )
		return;

	if ( bdv.getViewer().getVisibilityAndGrouping().getDisplayMode() != DisplayMode.FUSED )
	{
		final boolean[] active = new boolean[data.getSequenceDescription().getViewSetupsOrdered().size()];
		active[0] = true;
		setVisibleSources( bdv.getViewer().getVisibilityAndGrouping(), active );
		bdv.getViewer().getVisibilityAndGrouping().setDisplayMode( DisplayMode.FUSED );
		ScrollableBrightnessDialog.updateBrightnessPanels( bdv );
	}
}
 
Example #4
Source File: ViewSetupExplorerPanel.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
public static void setFusedModeSimple( final BigDataViewer bdv, final AbstractSpimData< ? > data )
{
	if ( bdv == null )
		return;

	if ( bdv.getViewer().getVisibilityAndGrouping().getDisplayMode() != DisplayMode.FUSED )
	{
		final boolean[] active = new boolean[ data.getSequenceDescription().getViewSetupsOrdered().size() ];
		active[ 0 ] = true;
		setVisibleSources( bdv.getViewer().getVisibilityAndGrouping(), active );
		bdv.getViewer().getVisibilityAndGrouping().setDisplayMode( DisplayMode.FUSED );
	}
}
 
Example #5
Source File: BDVRenderingState.java    From 3Dscript with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DisplayMode getDisplayMode() {
	return DisplayMode.values()[(int)nonChannelProperties[DISPLAY_MODE]];
}
 
Example #6
Source File: BDVRenderer.java    From 3Dscript with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BDVRenderer(File xmlFile) throws SpimDataException {
		openBDV(xmlFile);
//		this.tgtW = 0; // TODO
//		this.tgtH = 0; // TODO

		float[] pdOut = new float[] {1, 1, 1};
		float[] pdIn  = new float[] {1, 1, 1};

		this.rotationCenter = calculateRotationCenter();
		System.out.println("rotcenter: " + Arrays.toString(rotationCenter));
		float[] rotcenter = rotationCenter.clone();

		CombinedTransform transformation = new CombinedTransform(pdIn, pdOut, rotcenter);
		DisplayMode mode = viewer.getViewer().getVisibilityAndGrouping().getDisplayMode();
		int tp = viewer.getViewer().getState().getCurrentTimepoint();
		Interpolation interpolation = viewer.getViewer().getState().getInterpolation();
		int currentSource = viewer.getViewer().getState().getCurrentSource();
		int nSources = viewer.getViewer().getState().numSources();
		double[] min = new double[nSources];
		double[] max = new double[nSources];
		Color[] colors = new Color[nSources];

		SetupAssignments setupAssignments = viewer.getSetupAssignments();
		for(int s = 0; s < nSources; s++) {
			final ConverterSetup setup = setupAssignments.getConverterSetups().get(s);
			colors[s] = new Color(setup.getColor().get());
			min[s] = setup.getDisplayRangeMin();
			max[s] = setup.getDisplayRangeMax();
		}

		this.rs = new BDVRenderingState(0,
				mode,
				tp,
				interpolation,
				currentSource, // current source
				transformation,
				colors,
				min,
				max);

	}
 
Example #7
Source File: BDVRenderer.java    From 3Dscript with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ImageProcessor render(RenderingState kf) {
	BDVRenderingState bkf = (BDVRenderingState)kf;
	ViewerPanel panel = viewer.getViewer();
	ViewerState state = panel.getState();

	SetupAssignments setupAssignments = viewer.getSetupAssignments();
	for(int s = 0; s < state.numSources(); s++) {
		final ConverterSetup setup = setupAssignments.getConverterSetups().get(s);
		setup.setColor(new ARGBType(bkf.getChannelColor(s).getRGB()));
		setup.setDisplayRange(bkf.getChannelMin(s), bkf.getChannelMax(s));
	}

	DisplayMode displaymode = bkf.getDisplayMode();
	Interpolation interpolation = bkf.getInterpolation();
	int timepoint = bkf.getTimepoint();
	int currentSource = bkf.getCurrentSource();

	panel.setDisplayMode(displaymode);
	if(state.getInterpolation() != interpolation)
		panel.toggleInterpolation();
	panel.setTimepoint(timepoint);
	panel.getVisibilityAndGrouping().setCurrentSource(currentSource);

	CombinedTransform transform = kf.getFwdTransform();

	float[] tmp = calculateForwardTransform(transform);


	int w = panel.getWidth();
	int h = panel.getHeight();

	double rw = 2 * rotationCenter[0];
	double rh = 2 * rotationCenter[1];
	double scaleX = w / rw;
	double scaleY = h / rh;
	double scale = Math.min(scaleX, scaleY);
	rw = rw * scale;
	rh = rh * scale;
	double tx = (w - rw) / 2;
	double ty = (h - rh) / 2;

	AffineTransform3D affine = new AffineTransform3D();

	affine.set(toDouble(tmp));

	affine.scale(scale);
	affine.translate(tx, ty, 0);

	panel.setCurrentViewerTransform(affine);

	return takeSnapshot().getProcessor();
}