Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show SourceAndConverter #40

Closed
wants to merge 4 commits into from

Conversation

tischi
Copy link

@tischi tischi commented Oct 29, 2019

Hi @tpietzsch,

I started working on making it possible to show a SourceAndConverter.

This seems to work:
https://github.com/tischi/bigdataviewer-vistools/blob/displaySourceAndConverter/src/test/java/bdv/util/ExampleSourceAndConverter4D.java#L19

However, it will fail if the converter is not a ColorConverter, see here: #37

I think the solution could be to implement a wrapper like sketched below in net.imglib2.display:

public static class ARGBConverter extends ScaledARGBConverter< ARGBType >
{          
        Converter< ?, ARGBType > converter
		
        public ARGB( final Converter< ?, ARGBType > converter, final double min, final double max )
	{
               this.converter = converter;
 	       super( min, max );
	}

	@Override
	public void convert( final ? input, final ARGBType output )
	{
               converter.convert( input, output );
	       output.set( getScaledColor( output.get() ) );
	}
}

, which would be called in case the provided Converter is not yet a ColorConverter.

What do you think?

@tischi tischi changed the title WIP: Improve ExampleSourceAndConverter4D WIP: show SourceAndConverter Oct 29, 2019
@tischi tischi changed the title WIP: show SourceAndConverter Show SourceAndConverter Dec 19, 2019
@tischi
Copy link
Author

tischi commented Dec 19, 2019

To make this PR less complex I, for now, added code that throws an error if the Converter of the SourceAndConverter is not ColorConverter: https://github.com/tischi/bigdataviewer-vistools/blob/16507715f822113a76582ceab98d250774496c9e/src/main/java/bdv/util/BdvFunctions.java#L214

I think this restriction could be removed later by implementing above mentioned changes to net.imglib2.display.

tpietzsch added a commit that referenced this pull request Jan 8, 2024
@tpietzsch
Copy link
Member

I'm closing this.
In the meantime, BdvFunctions.show(SourceAndConverter, ...) was already added...
I just cherry-picked the ExampleSourceAndConverter4D from this PR (2e0f139).

@tpietzsch tpietzsch closed this Jan 8, 2024
axtimwalde pushed a commit to axtimwalde/bigdataviewer-vistools that referenced this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants