public class DefaultLUTService extends AbstractService implements LUTService
ColorTable
s from files (hosted locally or
externally).Constructor and Description |
---|
DefaultLUTService() |
Modifier and Type | Method and Description |
---|---|
void |
applyLUT(ColorTable colorTable,
ImageDisplay display)
Applies the given
ColorTable to the active view of the specified
ImageDisplay . |
Dataset |
createDataset(String title,
ColorTable colorTable)
Creates a new dataset showing the given
ColorTable as a ramp. |
Map<String,URL> |
findLUTs()
Finds the
URL s of the LUT files known to ImageJ. |
void |
initialize() |
boolean |
isLUT(File file)
Gets whether the given file can be parsed as a color table by
LUTService.loadLUT(File) . |
ColorTable |
loadLUT(File file)
Loads a
ColorTable from a File . |
ColorTable |
loadLUT(InputStream is)
Loads a
ColorTable from an input stream. |
ColorTable |
loadLUT(InputStream is,
int length)
Loads a
ColorTable from an input stream with the given expected
length. |
ColorTable |
loadLUT(URL url)
Loads a
ColorTable from a URL . |
getContext, setContext, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
public Map<String,URL> findLUTs()
LUTService
URL
s of the LUT files known to ImageJ. LUT files can
reside within a JAR file on the classpath, or in the luts
subdirectory of the application.findLUTs
in interface LUTService
public boolean isLUT(File file)
LUTService
LUTService.loadLUT(File)
.
This method is heuristic in nature, and does not offer a guarantee that
calling LUTService.loadLUT(File)
will be successful. However, if it returns
false, it is highly likely that the file is not parsable as a
ColorTable
.
isLUT
in interface LUTService
public ColorTable loadLUT(File file) throws IOException
LUTService
ColorTable
from a File
.loadLUT
in interface LUTService
file
- The file from which the color table data will be read.IOException
- if there is a problem reading the color tablepublic ColorTable loadLUT(URL url) throws IOException
LUTService
ColorTable
from a URL
.loadLUT
in interface LUTService
url
- The URL from which the color table data will be read.IOException
- if there is a problem reading the color tablepublic ColorTable loadLUT(InputStream is) throws IOException
LUTService
ColorTable
from an input stream.
Does not close the input stream after reading the color table.
loadLUT
in interface LUTService
is
- The stream from which the color table data will be read.IOException
- if there is a problem reading the color tablepublic ColorTable loadLUT(InputStream is, int length) throws IOException
LUTService
ColorTable
from an input stream with the given expected
length.loadLUT
in interface LUTService
is
- The stream from which the color table data will be read.length
- The expected length of the input stream.IOException
- if there is a problem reading the color tablepublic Dataset createDataset(String title, ColorTable colorTable)
LUTService
ColorTable
as a ramp.createDataset
in interface LUTService
title
- The title of the new dataset.colorTable
- The color table to use.public void applyLUT(ColorTable colorTable, ImageDisplay display)
LUTService
ColorTable
to the active view of the specified
ImageDisplay
.applyLUT
in interface LUTService
public void initialize()
initialize
in interface Initializable
initialize
in interface Service
Copyright © 2014–2022 ImageJ. All rights reserved.