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

Inverted LUT #169

Closed
K-Meech opened this issue Jan 13, 2021 · 3 comments
Closed

Inverted LUT #169

K-Meech opened this issue Jan 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@K-Meech
Copy link
Collaborator

K-Meech commented Jan 13, 2021

For viewing SEM images with MoBIE, it'd be useful to have an inverted LUT available.

@tischi - I don't know how difficult this would be to add? There's a bunch of different colouring modes for label data, but not for raw images - right?

@K-Meech K-Meech added the enhancement New feature or request label Jan 13, 2021
@tischi
Copy link
Contributor

tischi commented Jan 13, 2021

This is definitely doable.

For the labels source the code inSourcesPanel looks like this:

    private void showLabelsSource( SourceAndMetadata< ? > sam )
    {
        final LazyLabelsARGBConverter lazyLabelsARGBConverter = new LazyLabelsARGBConverter();
        final ARGBConvertedRealSource source =
                new ARGBConvertedRealSource( sam.source(),
                        lazyLabelsARGBConverter );

        sam.metadata().bdvStackSource = BdvFunctions.show(
                source,
                1,
                BdvOptions.options().addTo( bdv ) );

        ...

A LUT in ImgLib2 is an ARGBConverter, for BDV more specifically and for single color LUTs, the class ColorConverter is the one to implement.

So, I would recommend you start playing by implementing a function in SourcesPanel:

    private void showIntensitySourceKimberlyTest( SourceAndMetadata< ? > sam )
    {
        final ColorConverter myColorConverter = new KimberlyColorConverter();
        final ARGBConvertedRealSource source =
                new ARGBConvertedRealSource( sam.source(), myColorConverter );

        sam.metadata().bdvStackSource = BdvFunctions.show(
                source,
                1,
                BdvOptions.options().addTo( bdv ) );

with

public class KimberlyColorConverter implements ColorConverter, Converter< RealType, VolatileARGBType >
{
    // here you implement the mapping from a number RealType value to a color ARGBType 
    // ...the Volatile stuff is needed for it to work when lazy-loading big image data
    // you can have a look at LazyLabelsARGBConverter for inspiration, but you should also implement ColorConverter,
    // because otherwise in BDV you cannot change the brightness and contrast
}

Enough pointers to give it a go? Let me know if you have questions!

In fact this may not work all the way, i.e. you may not be able to adjust B&C in the BDV UI, but give it a shot, then we can use what you have to implement it properly (we may need a newer version of BdvFunctions, which is current not yet in MoBIE...)

@K-Meech
Copy link
Collaborator Author

K-Meech commented Jan 14, 2021

Thanks for the pointers! I'll give it a try next week.

@tischi
Copy link
Contributor

tischi commented Dec 7, 2023

mobie/mobie.github.io#45 seems to work.

@tischi tischi closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants