Class DecoderRAW
- java.lang.Object
- 
- jj2000.j2k.decoder.Decoder
- 
- gov.nih.mipav.model.file.rawjp2.DecoderRAW
 
 
- 
- All Implemented Interfaces:
- java.lang.Runnable
 
 public class DecoderRAW extends jj2000.j2k.decoder.DecoderThis class is the main class of JJ2000's decoder. It instantiates all objects and performs the decoding operations. It then writes the image to the output file or displays it.First the decoder should be initialized with a ParameterList object given through the constructor. The when the run() method is invoked and the decoder executes. The exit code of the class can be obtained with the getExitCode() method, after the constructor and after the run method. A non-zero value indicates that an error has ocurred. The decoding chain corresponds to the following sequence of modules: - BitstreamReaderAgent
- EntropyDecoder
- ROIDeScaler
- Dequantizer
- InverseWT
- ImgDataConverter
- EnumratedColorSpaceMapper, SyccColorSpaceMapper or ICCProfiler
- ComponentDemixer (if needed)
- ImgDataAdapter (if ComponentDemixer is needed)
- ImgWriter
- BlkImgDataSrcImageProducer
 The 2 last modules cannot be used at the same time and corresponds respectively to the writing of decoded image into a file or the graphical display of this same image. The behaviour of each module may be modified according to the current tile-component. All the specifications are kept in modules extending ModuleSpec and accessible through an instance of DecoderSpecs class. - See Also:
- BitstreamReaderAgent,- EntropyDecoder,- ROIDeScaler,- Dequantizer,- InverseWT,- ImgDataConverter,- InvCompTransf,- ImgWriter,- BlkImgDataSrcImageProducer,- ModuleSpec,- DecoderSpecs
 
- 
- 
Field SummaryFields Modifier and Type Field Description private colorspace.ColorSpacecsMapParses the inputstream to analyze the box structure of the JP2 file.private jj2000.j2k.util.ParameterListdefplThe default parameter list (arguments)private intexitCodeThe exit code of the run methodprivate jj2000.j2k.codestream.HeaderInfohiInformation contained in the codestream's headersprivate booleanisChildProcessFalse if the DecoderRAW instance is self-contained process, false if thrown by another process (i.e by a GUI)private jj2000.disp.ImgScrollPaneispThe component where the image is to be displayedprivate static java.lang.String[][]pinfoThe parameter information for this classprivate jj2000.j2k.util.ParameterListplThe parameter list (arguments)(package private) jj2000.disp.TitleUpdatertitleReference to the TitleUpdater instance.private static char[]vprfxsThe valid list of options prefixesprivate java.awt.FramewinFrame used to display decoded image
 - 
Constructor SummaryConstructors Constructor Description DecoderRAW(jj2000.j2k.util.ParameterList pl)Instantiates a decoder object, with the ParameterList object given as argument.DecoderRAW(jj2000.j2k.util.ParameterList pl, jj2000.disp.ImgScrollPane isp)Instantiates a decoder object, with the ParameterList object given as argument and a component where to display the image if no output file is specified.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiderror(java.lang.String msg, int code)Prints the error message 'msg' to standard err, prepending "ERROR" to it, and sets the exitCode to 'code'.private voiderror(java.lang.String msg, int code, java.lang.Throwable ex)Prints the error message 'msg' to standard err, prepending "ERROR" to it, and sets the exitCode to 'code'.voidexit()Exit the decoding process according to the isChildProcess variablestatic java.lang.String[][]getAllParameters()Returns all the parameters used in the decoding chain.java.lang.String[]getCOMInfo()Return the information found in the COM marker segments encountered in the decoded codestream.intgetExitCode()Returns the exit code of the class.static java.lang.String[][]getParameterInfo()Returns the parameters that are used in this class.private voidprintParamInfo(jj2000.j2k.util.MsgLogger out, java.lang.String[][] pinfo)Prints the parameters in 'pinfo' to the provided output, 'out', showing the existing defaults.private voidprintUsage()Prints the usage information to stdout.private voidprintVersionAndCopyright()Prints version and copyright information to the logging facility returned by FacilityManager.getMsgLogger()voidrun()Runs the decoder.jj2000.j2k.image.BlkImgDataSrcrun1Slice(jj2000.j2k.io.RandomAccessIO inBuff)voidrunAllSlices()voidsetChildProcess(boolean b)Set isChildProcess variable.private voidwarning(java.lang.String msg)Prints the warning message 'msg' to standard err, prepending "WARNING" to it.
 
- 
- 
- 
Field Detail- 
csMapprivate colorspace.ColorSpace csMap Parses the inputstream to analyze the box structure of the JP2 file.
 - 
titlejj2000.disp.TitleUpdater title Reference to the TitleUpdater instance. Only used when decoded image is displayed
 - 
isChildProcessprivate boolean isChildProcess False if the DecoderRAW instance is self-contained process, false if thrown by another process (i.e by a GUI)
 - 
exitCodeprivate int exitCode The exit code of the run method
 - 
plprivate jj2000.j2k.util.ParameterList pl The parameter list (arguments)
 - 
hiprivate jj2000.j2k.codestream.HeaderInfo hi Information contained in the codestream's headers
 - 
defplprivate jj2000.j2k.util.ParameterList defpl The default parameter list (arguments)
 - 
vprfxsprivate static final char[] vprfxs The valid list of options prefixes
 - 
winprivate java.awt.Frame win Frame used to display decoded image
 - 
ispprivate jj2000.disp.ImgScrollPane isp The component where the image is to be displayed
 - 
pinfoprivate static final java.lang.String[][] pinfo The parameter information for this class
 
- 
 - 
Constructor Detail- 
DecoderRAWpublic DecoderRAW(jj2000.j2k.util.ParameterList pl, jj2000.disp.ImgScrollPane isp)Instantiates a decoder object, with the ParameterList object given as argument and a component where to display the image if no output file is specified. It also retrieves the default ParameterList.- Parameters:
- pl- The ParameterList for this decoder (contains also defaults values).
- isp- The component where the image is to be displayed if not output file is specified. If null a new frame will be created to display the image.
 
 - 
DecoderRAWpublic DecoderRAW(jj2000.j2k.util.ParameterList pl) Instantiates a decoder object, with the ParameterList object given as argument. It also retrieves the default ParameterList.- Parameters:
- pl- The ParameterList for this decoder (contains also defaults values).
 
 
- 
 - 
Method Detail- 
getExitCodepublic int getExitCode() Returns the exit code of the class. This is only initialized after the constructor and when the run method returns.- Overrides:
- getExitCodein class- jj2000.j2k.decoder.Decoder
- Returns:
- The exit code of the constructor and the run() method.
 
 - 
getParameterInfopublic static java.lang.String[][] getParameterInfo() Returns the parameters that are used in this class. It returns a 2D String array. Each of the 1D arrays is for a different option, and they have 3 elements. The first element is the option name, the second one is the synopsis and the third one is a long description of what the parameter is. The synopsis or description may be 'null', in which case it is assumed that there is no synopsis or description of the option, respectively.- Returns:
- the options name, their synopsis and their explanation.
 
 - 
runpublic void run() Runs the decoder. After completion the exit code is set, a non-zero value indicates that an error ocurred.- Specified by:
- runin interface- java.lang.Runnable
- Overrides:
- runin class- jj2000.j2k.decoder.Decoder
- See Also:
- getExitCode()
 
 - 
run1Slicepublic jj2000.j2k.image.BlkImgDataSrc run1Slice(jj2000.j2k.io.RandomAccessIO inBuff) 
 - 
runAllSlicespublic void runAllSlices() 
 - 
errorprivate void error(java.lang.String msg, int code)Prints the error message 'msg' to standard err, prepending "ERROR" to it, and sets the exitCode to 'code'. An exit code different than 0 indicates that there where problems.- Parameters:
- msg- The error message
- code- The exit code to set
 
 - 
errorprivate void error(java.lang.String msg, int code, java.lang.Throwable ex)Prints the error message 'msg' to standard err, prepending "ERROR" to it, and sets the exitCode to 'code'. An exit code different than 0 indicates that there where problems. Either the stacktrace or a "details" message is output depending on the data of the "debug" parameter.- Parameters:
- msg- The error message
- code- The exit code to set
- ex- The exception associated with the call
 
 - 
getCOMInfopublic java.lang.String[] getCOMInfo() Return the information found in the COM marker segments encountered in the decoded codestream.- Overrides:
- getCOMInfoin class- jj2000.j2k.decoder.Decoder
 
 - 
getAllParameterspublic static java.lang.String[][] getAllParameters() Returns all the parameters used in the decoding chain. It calls parameter from each module and store them in one array (one row per parameter and 4 columns).- Returns:
- All decoding parameters
- See Also:
- getParameterInfo()
 
 - 
warningprivate void warning(java.lang.String msg) Prints the warning message 'msg' to standard err, prepending "WARNING" to it.- Parameters:
- msg- The error message
 
 - 
printVersionAndCopyrightprivate void printVersionAndCopyright() Prints version and copyright information to the logging facility returned by FacilityManager.getMsgLogger()
 - 
printUsageprivate void printUsage() Prints the usage information to stdout. The usage information is written for all modules in the decoder.
 - 
printParamInfoprivate void printParamInfo(jj2000.j2k.util.MsgLogger out, java.lang.String[][] pinfo)Prints the parameters in 'pinfo' to the provided output, 'out', showing the existing defaults. The message is printed to the logging facility returned by FacilityManager.getMsgLogger(). The 'pinfo' argument is a 2D String array. The first dimension contains String arrays, 1 for each parameter. Each of these arrays has 3 elements, the first element is the parameter name, the second element is the synopsis for the parameter and the third one is a long description of the parameter. If the synopsis or description is 'null' then no synopsis or description is printed, respectively. If there is a default value for a parameter it is also printed.- Parameters:
- out- Where to print.
- pinfo- The parameter information to write.
 
 - 
exitpublic void exit() Exit the decoding process according to the isChildProcess variable- Overrides:
- exitin class- jj2000.j2k.decoder.Decoder
 
 - 
setChildProcesspublic void setChildProcess(boolean b) Set isChildProcess variable.- Overrides:
- setChildProcessin class- jj2000.j2k.decoder.Decoder
- Parameters:
- b- The boolean value
 
 
- 
 
-