Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0034c2a
integration of JasPer for decoding JPEG2000-compressed dicom images
Feb 4, 2010
e3c0683
remove debug output
Feb 4, 2010
7d214e4
Merge branch 'master' into jasper
Feb 4, 2010
90c6055
include missing JasPer lib
Feb 4, 2010
284744c
Merge branch 'master' into jasper
Feb 4, 2010
0dc7c82
Merge branch 'master' into jasper
Feb 4, 2010
b592d2a
Merge branch 'master' into jasper
Feb 4, 2010
4f92324
Merge branch 'master' into jasper
Feb 8, 2010
5e2402d
Merge branch 'jasper' of [email protected]:hmeyer/dcmtk into jasper
Feb 8, 2010
d903199
support for STD libs
Feb 17, 2010
2441830
reorganization and support for DicomQuereRetrieveLuceneIndex(DicomQue…
Feb 17, 2010
0e570d7
Merge branch 'master' into jasper
Feb 17, 2010
ef44601
Merge branch 'master' of [email protected]:hmeyer/dcmtk into jasper
Feb 17, 2010
5bb1219
Merge branch 'jasper' of [email protected]:hmeyer/dcmtk into jasper
Feb 17, 2010
9b34453
needed better access to config data
Feb 18, 2010
85e0758
Merge branch 'master' into jasper
Feb 18, 2010
60ffc81
Merge branch 'jasper' of [email protected]:hmeyer/dcmtk into jasper
Feb 18, 2010
80d8d82
better performance due to fewer index flushes
Feb 23, 2010
cbe7cb9
Merge branch 'master' into jasper
Feb 23, 2010
d410457
Merge branch 'master' of [email protected]:hmeyer/dcmtk into jasper
Feb 23, 2010
ef496a6
show duplicate file names
Feb 23, 2010
3c764e8
better Analyser for Dicom
Feb 23, 2010
dd05627
Merge branch 'master' into jasper
Feb 23, 2010
a9bee03
Merge branch 'master' of [email protected]:hmeyer/dcmtk into jasper
Mar 4, 2010
8db72af
Merge branch 'jasper' of [email protected]:hmeyer/dcmtk into jasper
Mar 4, 2010
fef076f
more verbose errors
Mar 4, 2010
1acf7cd
Merge branch 'master' into jasper
Mar 4, 2010
8a1ab10
included JASPERLIBS
Apr 1, 2010
0b8da60
added Makefile switches
Sep 8, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/Makefile.def.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ OPENSSLLIBS = @OPENSSLLIBS@
TIFFLIBS = @TIFFLIBS@
PNGLIBS = @PNGLIBS@
ZLIBLIBS = @ZLIBLIBS@
JASPERLIBS = -ljasper
CLUCENELIBS = -lclucene-core
BOOSTLIBS = -lboost_system-mt -lboost_filesystem-mt
XMLLIBS = @XMLLIBS@
Expand Down
2 changes: 1 addition & 1 deletion dcmjpeg/apps/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ LOCALINCLUDES = $(dcmjpeginc) $(ofstdinc) $(dcmdatainc) $(dcmimageinc) $(dcmimgl
LIBDIRS = -L$(top_srcdir)/libsrc $(dcmjpeglibdir) $(dcmimagelibdir) $(dcmimglelibdir) \
$(dcmdatalibdir) $(ofstdlibdir)
LOCALLIBS = $(dcmjpeglib) $(dcmimagelib) $(dcmimglelib) $(dcmdatalib) $(ofstdlib) \
$(TIFFLIBS) $(PNGLIBS) $(ZLIBLIBS)
$(TIFFLIBS) $(PNGLIBS) $(ZLIBLIBS) $(JASPERLIBS)

objs = dcmdjpeg.o dcmcjpeg.o dcmj2pnm.o dcmmkdir.o
progs = dcmdjpeg dcmcjpeg dcmj2pnm dcmmkdir
Expand Down
53 changes: 53 additions & 0 deletions dcmjpeg/include/dcmtk/dcmjpeg/djdecjp2lol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
*
* Module: dcmjpeg
*
* Author: Henning Meyer
*
* Purpose: Codec class for decoding JPEG2000 Lossless
*
*/

#ifndef DJDECJP2LOL_H
#define DJDECJP2LOL_H

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmjpeg/djcodecd.h" /* for class DJCodecDecoder */


/** Decoder class for JPEG2000 Lossless
*/
class DJDecoderJPEG2000Lossless : public DJCodecDecoder
{
public:

/// default constructor
DJDecoderJPEG2000Lossless();

/// destructor
virtual ~DJDecoderJPEG2000Lossless();

/** returns the transfer syntax that this particular codec
* is able to encode and decode.
* @return supported transfer syntax
*/
virtual E_TransferSyntax supportedTransferSyntax() const;

private:

/** creates an instance of the compression library to be used for decoding.
* @param toRepParam representation parameter passed to decode()
* @param cp codec parameter passed to decode()
* @param bitsPerSample bits per sample for the image data
* @param isYBR flag indicating whether DICOM photometric interpretation is YCbCr
* @return pointer to newly allocated decoder object
*/
virtual DJDecoder *createDecoderInstance(
const DcmRepresentationParameter * toRepParam,
const DJCodecParameter *cp,
Uint8 bitsPerSample,
OFBool isYBR) const;

};

#endif
4 changes: 4 additions & 0 deletions dcmjpeg/include/dcmtk/dcmjpeg/djdecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DJDecoderLossless;
class DJDecoderP14SV1;
class DJDecoderProgressive;
class DJDecoderSpectralSelection;
class DJDecoderJPEG2000Lossless;

/** singleton class that registers decoders for all supported JPEG processes.
*/
Expand Down Expand Up @@ -98,6 +99,9 @@ class DJDecoderRegistration

/// pointer to decoder for lossless JPEG
static DJDecoderLossless *declol;

/// pointer to decoder for lossless JPEG2000
static DJDecoderJPEG2000Lossless *decjp2lol;

};

Expand Down
114 changes: 114 additions & 0 deletions dcmjpeg/include/dcmtk/dcmjpeg/djdjp2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
*
* Module: dcmjpeg
*
* Author: Henning Meyer
*
* Purpose: decompression routines of the Jasper JPEG2000 library
*
*/

#ifndef DJDJP2_H
#define DJDJP2_H

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmjpeg/djdecabs.h" /* for class DJDecoder */

#include <boost/scoped_ptr.hpp>
using namespace boost;

class DJCodecParameter;

/** this class encapsulates the decompression routines of the
* JasPer JPEG library
*/
class DJDecompressJPEG2000 : public DJDecoder
{
public:

/** constructor
* @param cp codec parameters
* @param isYBR flag indicating if DICOM photometric interpretation is YCbCr
*/
DJDecompressJPEG2000(const DJCodecParameter& cp, OFBool isYBR, Uint8 bitsPerSample);

/// destructor
virtual ~DJDecompressJPEG2000();

/** initializes internal object structures.
* Must be called before a new frame is decompressed.
* @return EC_Normal if successful, an error code otherwise
*/
virtual OFCondition init();

/** suspended decompression routine. Decompresses a JPEG frame
* until finished or out of data. Can be called with new data
* until a frame is complete.
* @param compressedFrameBuffer pointer to compressed input data, must not be NULL
* @param compressedFrameBufferSize size of buffer, in bytes
* @param uncompressedFrameBuffer pointer to uncompressed output data, must not be NULL.
* This buffer must not change between multiple decode() calls for a single frame.
* @param uncompressedFrameBufferSize size of buffer, in bytes (!)
* Buffer must be large enough to contain a complete frame.
* @param isSigned OFTrue, if uncompressed pixel data is signed, OFFalse otherwise
* @return EC_Normal if successful, EC_Suspend if more data is needed, an error code otherwise.
*/
virtual OFCondition decode(
Uint8 *compressedFrameBuffer,
Uint32 compressedFrameBufferSize,
Uint8 *uncompressedFrameBuffer,
Uint32 uncompressedFrameBufferSize,
OFBool isSigned);

/** returns the number of bytes per sample that will be written when decoding.
*/
virtual Uint16 bytesPerSample() const
{
return sizeof(Uint16);
}

/** after successful compression,
* returns the color model of the decompressed image
*/
virtual EP_Interpretation getDecompressedColorModel() const
{
return decompressedColorModel;
}

/** callback function used to report warning messages and the like.
* Should not be called by user code directly.
*/
virtual void outputMessage() const;

private:

/// private undefined copy constructor
DJDecompressJPEG2000(const DJDecompressJPEG2000&);

/// private undefined copy assignment operator
DJDecompressJPEG2000& operator=(const DJDecompressJPEG2000&);

/// cleans up cinfo structure, called from destructor and error handlers
void cleanup();
/*
/// codec parameters
const DJCodecParameter *cparam;

/// decompression structure
jpeg_decompress_struct *cinfo;

/// position of last suspend
int suspension;

/// temporary storage for row buffer during suspension
void *jsampBuffer;

/// Flag indicating if DICOM photometric interpretation is YCbCr
OFBool dicomPhotometricInterpretationIsYCbCr;
*/

/// color model after decompression
EP_Interpretation decompressedColorModel;
};

#endif
8 changes: 8 additions & 0 deletions dcmjpeg/include/dcmtk/dcmjpeg/djutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ extern const OFCondition EJ_IJG16_FrameBufferTooSmall;
extern const OFCondition EJ_UnsupportedPhotometricInterpretation;
/// Codec does not support this kind of color conversion
extern const OFCondition EJ_UnsupportedColorConversion;
/// Codec implementation does not support multiple Components
extern const OFCondition EJ_UnsupportedNumberOfComponents;
/// Coded and expected Signedness do not match
extern const OFCondition EJ_ConflictingSignedness;
/// Error in JPEG2000 decoder
extern const OFCondition EJ_JPEG2000DecoderError;


// reserved condition codes for IJG error messages
const unsigned short EJCode_IJG8_Compression = 0x0100;
Expand All @@ -178,6 +185,7 @@ const unsigned short EJCode_IJG12_Compression = 0x0102;
const unsigned short EJCode_IJG12_Decompression = 0x0103;
const unsigned short EJCode_IJG16_Compression = 0x0104;
const unsigned short EJCode_IJG16_Decompression = 0x0105;
const unsigned short EJCode_JP2_Decompression = 0x0106;

/** helper class with static methods used from different dcmjpeg classes
* (in particular from the encoder and the decoder part).
Expand Down
3 changes: 2 additions & 1 deletion dcmjpeg/libsrc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ LOCALDEFS =
objs = djutils.o djencode.o djrplol.o djrploss.o djcparam.o djeijg8.o djdijg8.o \
djcodecd.o djdecbas.o djdecext.o djdecpro.o djdecsps.o djdeclol.o djdecsv1.o \
djcodece.o djencbas.o djencext.o djencpro.o djencsps.o djenclol.o djencsv1.o \
djeijg12.o djdijg12.o djeijg16.o djdijg16.o djdecode.o dipijpeg.o ddpiimpl.o
djeijg12.o djdijg12.o djeijg16.o djdijg16.o djdecode.o dipijpeg.o ddpiimpl.o \
djdecjp2lol.o djdjp2.o
library = libdcmjpeg.$(LIBEXT)


Expand Down
8 changes: 7 additions & 1 deletion dcmjpeg/libsrc/djcodecd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ OFCondition DJCodecDecoder::decode(
result = pixItem->getUint8Array(jpegData);
if (result.good())
{
Uint8 precision = scanJpegDataForBitDepth(jpegData, fragmentLength);
Uint8 precision = 0;

if (supportedTransferSyntax() == EXS_JPEG2000LosslessOnly) {
precision = imageBitsStored;
} else {
precision = scanJpegDataForBitDepth(jpegData, fragmentLength);
}
if (precision == 0) result = EC_CannotChangeRepresentation; // something has gone wrong, bail out
else
{
Expand Down
43 changes: 43 additions & 0 deletions dcmjpeg/libsrc/djdecjp2lol.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
*
* Module: dcmjpeg
*
* Author: Henning Meyer
*
* Purpose: Codec class for decoding JPEG2000 Lossless
*
*/

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmjpeg/djdecjp2lol.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmjpeg/djdjp2.h"

#include <iostream>
using namespace std;

DJDecoderJPEG2000Lossless::DJDecoderJPEG2000Lossless()
: DJCodecDecoder()
{
}


DJDecoderJPEG2000Lossless::~DJDecoderJPEG2000Lossless()
{
}


E_TransferSyntax DJDecoderJPEG2000Lossless::supportedTransferSyntax() const
{
return EXS_JPEG2000LosslessOnly;
}


DJDecoder *DJDecoderJPEG2000Lossless::createDecoderInstance(
const DcmRepresentationParameter * /* toRepParam */,
const DJCodecParameter *cp,
Uint8 bitsPerSample,
OFBool isYBR) const
{
return new DJDecompressJPEG2000( *cp, isYBR, bitsPerSample );
}
8 changes: 8 additions & 0 deletions dcmjpeg/libsrc/djdecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "dcmtk/dcmjpeg/djdecpro.h"
#include "dcmtk/dcmjpeg/djdecsv1.h"
#include "dcmtk/dcmjpeg/djdeclol.h"
#include "dcmtk/dcmjpeg/djdecjp2lol.h"
#include "dcmtk/dcmjpeg/djcparam.h"

// initialization of static members
Expand All @@ -52,6 +53,7 @@ DJDecoderSpectralSelection *DJDecoderRegistration::decsps = NULL;
DJDecoderProgressive *DJDecoderRegistration::decpro = NULL;
DJDecoderP14SV1 *DJDecoderRegistration::decsv1 = NULL;
DJDecoderLossless *DJDecoderRegistration::declol = NULL;
DJDecoderJPEG2000Lossless *DJDecoderRegistration::decjp2lol = NULL;

void DJDecoderRegistration::registerCodecs(
E_DecompressionColorSpaceConversion pDecompressionCSConversion,
Expand Down Expand Up @@ -93,6 +95,10 @@ void DJDecoderRegistration::registerCodecs(
declol = new DJDecoderLossless();
if (declol) DcmCodecList::registerCodec(declol, NULL, cp);

// lossless JPEG2000
decjp2lol = new DJDecoderJPEG2000Lossless();
if (decjp2lol) DcmCodecList::registerCodec(decjp2lol, NULL, cp);

registered = OFTrue;
}
}
Expand All @@ -114,6 +120,8 @@ void DJDecoderRegistration::cleanup()
delete decsv1;
DcmCodecList::deregisterCodec(declol);
delete declol;
DcmCodecList::deregisterCodec(decjp2lol);
delete decjp2lol;
delete cp;
registered = OFFalse;
#ifdef DEBUG
Expand Down
Loading