📄 diimage.h
字号:
* ** @param data untyped pointer memory buffer (set to NULL if not allocated externally) * @param size size of the memory buffer in bytes (if 0 'data' is set to NULL) * @param frame index of frame to be converted (starting from 0) * @param bits number of bits per pixel used for the output bitmap (8, 24 or 32) * @param upsideDown specifies the order of lines in the images (0 = top-down, bottom-up otherwise) * @param padding align each line to a 32-bit address if true (default) * ** @return number of bytes allocated by the bitmap, or 0 if an error occured */ virtual unsigned long createDIB(void *&data, const unsigned long size, const unsigned long frame, const int bits, const int upsideDown, const int padding = 1) = 0; /** create true color (32 bit) bitmap for Java AWT (abstract). * ** @param data resulting pointer to bitmap data (set to NULL if an error occurred) * @param frame index of frame to be converted * @param bits number of bits per pixel used for the output bitmap (8 or 32) * ** @return number of bytes allocated by the bitmap, or 0 if an error occured */ virtual unsigned long createAWTBitmap(void *&data, const unsigned long frame, const int bits) = 0; /** render pixel data of given frame and write image related attributes to DICOM dataset. * ** @param dataset reference to DICOM dataset where the image attributes are stored * @param frame index of frame used for output * @param bits number of bits used for output of pixel data * @param planar flag, whether the output data (for multi-planar images) should be planar or not * ** @return true if successful, false otherwise */ int writeFrameToDataset(DcmItem &dataset, const unsigned long frame = 0, const int bits = 0, const int planar = 0); /** write current image and related attributes to DICOM dataset. * ** @param dataset reference to DICOM dataset where the image attributes are stored * @param mode determine value of BitsStored from 'used' or 'possible' pixel values * ** @return true if successful, false otherwise */ virtual int writeImageToDataset(DcmItem &dataset, const int mode = 0) = 0; /** write pixel data to PPM file (abstract). * pixel data is written in ASCII format. * ** @param stream open C++ output stream * @param frame index of frame used for output * @param bits number of bits used for output of pixel data * ** @return true if successful, false otherwise */ virtual int writePPM(ostream &stream, const unsigned long frame, const int bits) = 0; /** write pixel data to PPM file (abstract). * pixel data is written in ASCII format. * ** @param stream open C output stream * @param frame index of frame used for output * @param bits number of bits used for output of pixel data * ** @return true if successful, false otherwise */ virtual int writePPM(FILE *stream, const unsigned long frame, const int bits) = 0; /** write pixel data to raw PPM file (abstract) * ** @param stream open C output stream * @param frame index of frame used for output * @param bits number of bits used for output of pixel data * ** @return true if successful, false otherwise */ virtual int writeRawPPM(FILE *stream, const unsigned long frame, const int bits) = 0; /** write pixel data to BMP file * ** @param stream open C output stream * @param frame index of frame used for output (default: first frame = 0) * @param bits number of bits used for output of pixel data (8 or 24) * ** @return true if successful, false otherwise */ virtual int writeBMP(FILE *stream, const unsigned long frame, const int bits); protected: /** constructor * ** @param docu pointer to the DICOM document * @param status status of the image object */ DiImage(const DiDocument *docu, const EI_Status status); /** constructor, copy * ** @param image pointer to reference image * @param fstart first frame to be processed * @param fcount number of frames */ DiImage(const DiImage *image, const unsigned long fstart, const unsigned long fcount); /** constructor, scale/clip * ** @param image pointer to reference image * @param width number of columns of the new image * @param height number of rows of the new image * @param aspect flag indicating whether pixel aspect ratio should be used or not */ DiImage(const DiImage *image, const Uint16 width, const Uint16 height, const int aspect = 0); /** constructor, rotate * ** @param image pointer to reference image * @param degree angle by which the image shall be rotated */ DiImage(const DiImage *image, const int degree = 0); /** constructor, createMonoOutput * ** @param image pointer to reference image * @param frame number of frame stored in the new image object * @param stored number of bits stored * @param alloc number of bits allocated */ DiImage(const DiImage *image, const unsigned long frame, const int stored, const int alloc); /** delete internally handled object for the input pixel data conversion */ void deleteInputData(); /** check and possibly correct values for pixel spacing, aspect ratio etc. */ void checkPixelExtension(); /** create input pixel data representation from DICOM dataset structures * ** @param pixel pointer to DICOM dataset structure storing the pixel data * @param spp samples per pixel */ void convertPixelData(/*const*/ DcmPixelData *pixel, const int spp); /** update Image Pixel Module attributes in the given dataset. * Removes smallest/largest pixel value and updates pixel aspect ratio as well * as imager/pixel spacing. * Used in writeXXXToDataset() routines. * ** @param dataset reference to DICOM image dataset */ virtual void updateImagePixelModuleAttributes(DcmItem &dataset); /** detach pixel data. * removes storage area used for the pixel data from memory */ int detachPixelData(); /// copy of status variable declared in class 'DicomImage' EI_Status ImageStatus; /// points to special object, which capsulates the DCMtk/DCMdata const DiDocument *Document; /// first frame to be processed Uint32 FirstFrame; /// number of frames in case of multi-frame images (otherwise '1') Uint32 NumberOfFrames; /// total number of frames stored in the dataset Uint32 TotalNumberOfFrames; /// number of representative frame, type 3 attribute (default '0') Uint32 RepresentativeFrame; /// number of rows (in pixel) Uint16 Rows; /// number of columns (in pixel) Uint16 Columns; /// width of each pixel according to 'PixelSpacing/AspectRatio' double PixelWidth; /// height of each pixel according to 'PixelSpacing/AspectRatio' double PixelHeight; /// number of bits allocated for each pixel Uint16 BitsAllocated; /// number of bits stored for each pixel (see 'BitsPerSample') Uint16 BitsStored; /// position of highest stored bit Uint16 HighBit; /// actual number of bits per sample (depth) int BitsPerSample; /// polarity (normal or reverse) EP_Polarity Polarity; /// is 'true' if pixel data is signed int hasSignedRepresentation; /// is 'true' if attribute 'PixelSpacing' is present int hasPixelSpacing; /// is 'true' if attribute 'ImagerPixelSpacing' is present int hasImagerPixelSpacing; /// is 'true' if attribute 'PixelAspectRatio' is present int hasPixelAspectRatio; /// is 'false' if derived from original image data (e.g. scaled) int isOriginal; /// points to intermediate pixel representation (template object) DiInputPixel *InputData; // --- declarations to avoid compiler warnings DiImage(const DiImage &); DiImage &operator=(const DiImage &);};#endif/* * * CVS/RCS Log: * $Log: diimage.h,v $ * Revision 1.38 2005/12/08 16:47:42 meichel * Changed include path schema for all DCMTK header files * * Revision 1.37 2005/03/09 17:32:35 joergr * Added mode to writeImageToDataset() which allows the value of BitsStored to * be determined either from 'used' or from 'possible' pixel values. * * Revision 1.36 2004/09/22 11:33:14 joergr * Introduced new member variable "TotalNumberOfFrames". * * Revision 1.35 2004/07/20 18:12:16 joergr * Added API method to "officially" access the internal intermediate pixel data * representation (e.g. to get Hounsfield Units for CT images). * * Revision 1.34 2004/02/06 11:07:50 joergr * Distinguish more clearly between const and non-const access to pixel data. * * Revision 1.33 2004/01/05 14:52:20 joergr * Removed acknowledgements with e-mail addresses from CVS log. * * Revision 1.32 2003/12/08 18:22:26 joergr * Removed leading underscore characters from preprocessor symbols (reserved * symbols). Updated CVS header. * * Revision 1.31 2003/06/12 15:08:34 joergr * Fixed inconsistent API documentation reported by Doxygen. * * Revision 1.30 2003/05/20 09:20:41 joergr * Added method returning the number of bytes required to store a single * rendered frame: getOutputDataSize(). * * Revision 1.29 2002/12/09 13:32:51 joergr * Renamed parameter/local variable to avoid name clashes with global * declaration left and/or right (used for as iostream manipulators). * * Revision 1.28 2002/11/27 14:08:04 meichel * Adapted module dcmimgle to use of new header file ofstdinc.h * * Revision 1.27 2002/11/26 14:48:32 joergr * Added Smallest/LargestImagePixelValue to the list of attributes to be * removed from a newly created dataset. * * Revision 1.26 2002/08/02 15:03:20 joergr * Enhanced writeFrameToDataset() routine (remove out-data DICOM attributes * from the dataset). * Added function to write the current image (not only a selected frame) to a * DICOM dataset. * * Revision 1.25 2002/06/26 16:01:55 joergr * Added support for polarity flag to color images. * Added new method to write a selected frame to a DICOM dataset (incl. required * attributes from the "Image Pixel Module"). * * Revision 1.24 2002/04/16 13:53:11 joergr * Added configurable support for C++ ANSI standard includes (e.g. streams). * * Revision 1.23 2002/01/29 17:05:50 joergr * Added optional flag to the "Windows DIB" methods allowing to switch off the * scanline padding. * * Revision 1.22 2001/11/27 18:18:22 joergr * Added support for plugable output formats in class DicomImage. First * implementation is JPEG. * * Revision 1.21 2001/11/09 16:26:37 joergr * Added support for Window BMP file format. * Enhanced and renamed createTrueColorDIB() method. * * Revision 1.20 2001/06/20 15:12:49 joergr * Enhanced multi-frame support for command line tool 'dcm2pnm': extract all * or a range of frames with one call. * * Revision 1.19 2001/06/01 15:49:42 meichel * Updated copyright header * * Revision 1.18 2000/03/08 16:24:16 meichel * Updated copyright header. * * Revision 1.17 2000/02/02 11:02:38 joergr * Removed space characters before preprocessor directives. * * Revision 1.16 1999/10/06 13:28:21 joergr * Corrected creation of PrintBitmap pixel data: VOI windows should be applied * before clipping to avoid that the region outside the image (border) is also * windowed (this requires a new method in dcmimgle to create a DicomImage * with the grayscale transformations already applied). * * Revision 1.15 1999/09/17 12:12:18 joergr * Added/changed/completed DOC++ style comments in the header files. * * Revision 1.14 1999/08/25 16:39:31 joergr * Allow clipping region to be outside the image (overlapping). * * Revision 1.13 1999/07/23 13:53:00 joergr * Added support for attribute 'ImagerPixelSpacing'. * Added support for attribute 'RepresentativeFrameNumber'. * Added methods to set 'PixelAspectRatio'. * * Revision 1.12 1999/04/28 14:47:34 joergr * Added experimental support to create grayscale images with more than 256 * shades of gray to be displayed on a consumer monitor (use pastel colors). * * Revision 1.11 1999/03/24 17:20:01 joergr * Added/Modified comments and formatting. * * Revision 1.10 1999/02/08 12:38:12 joergr * Added parameter 'idx' to some overlay methods to distinguish between * built-in and additional overlay planes. * * Revision 1.9 1999/02/03 17:01:45 joergr * Added BEGIN_EXTERN_C and END_EXTERN_C to some C includes. * * Revision 1.8 1999/01/20 14:59:37 joergr * Added new output method to fill external memory buffer with rendered pixel * data. * * Revision 1.7 1999/01/11 09:32:32 joergr * Removed method 'getMinMaxValues()' in class 'DicomImage'. * * Revision 1.6 1998/12/23 11:33:08 joergr * Corrected some typos and formatting. * * Revision 1.5 1998/12/22 14:03:53 joergr * Changed parameter declaration to avoid compiler warnings (hide parameter * name). * * Revision 1.4 1998/12/16 16:29:04 joergr * Removed several methods used for monochrome images only in base class * 'DiImage'. Introduced mechanism to use the methods directly. * * Revision 1.3 1998/12/14 17:17:29 joergr * Added methods to add and remove additional overlay planes (still untested). * * Revision 1.2 1998/11/30 12:24:07 joergr * Added const type qualifier to some parameters to avoid errors with MSVC5 * (couldn't create instance of abstract class). * * Revision 1.1 1998/11/27 15:06:08 joergr * Added copyright message. * Added methods and constructors for flipping and rotating, changed for * scaling and clipping. * Added method to directly create java AWT bitmaps. * Renamed variable 'Status' to 'ImageStatus' because of possible conflicts * with X windows systems. * Added method to detach pixel data if it is no longer needed. * Added methods to support presentation LUTs and shapes. * * Revision 1.6 1998/07/01 08:39:21 joergr * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional * options), e.g. add copy constructors. * * Revision 1.5 1998/05/11 14:53:16 joergr * Added CVS/RCS header to each file. * * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -