⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dimoipxt.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 2 页
字号:
            if (useInputBuffer)            {                                              // do not copy pixel data, reference them!                this->Data = OFstatic_cast(T3 *, input->getDataPtr());                input->removeDataReference();              // avoid double deletion            } else                this->Data = new T3[this->Count];            if (this->Data != NULL)            {                register T3 *q = this->Data;                register unsigned long i;                if ((slope == 1.0) && (intercept == 0.0))                {                    if (!useInputBuffer)                    {                        register const T1 *p = pixel + input->getPixelStart();                        for (i = this->InputCount; i != 0; --i)   // copy pixel data: can't use copyMem because T1 isn't always equal to T3                            *(q++) = OFstatic_cast(T3, *(p++));                    }                } else {#ifdef DEBUG                    if (DicomImageClass::checkDebugLevel(DicomImageClass::DL_Informationals))                    {                        ofConsole.lockCerr() << "INFO: using modality routine 'rescale()'" << endl;                        ofConsole.unlockCerr();                    }#endif                    T3 *lut = NULL;                    register const T1 *p = pixel + input->getPixelStart();                    const unsigned long ocnt = OFstatic_cast(unsigned long, input->getAbsMaxRange());  // number of LUT entries                    if (initOptimizationLUT(lut, ocnt))                    {                                                                     // use LUT for optimization                        const double absmin = input->getAbsMinimum();                        q = lut;                        if (slope == 1.0)                        {                            for (i = 0; i < ocnt; ++i)                                    // calculating LUT entries                                *(q++) = OFstatic_cast(T3, OFstatic_cast(double, i) + absmin + intercept);                        } else {                            if (intercept == 0.0)                            {                                for (i = 0; i < ocnt; ++i)                                    *(q++) = OFstatic_cast(T3, (OFstatic_cast(double, i) + absmin) * slope);                            } else {                                for (i = 0; i < ocnt; ++i)                                    *(q++) = OFstatic_cast(T3, (OFstatic_cast(double, i) + absmin) * slope + intercept);                            }                        }                        const T3 *lut0 = lut - OFstatic_cast(T2, absmin);                 // points to 'zero' entry                        q = this->Data;                        for (i = this->InputCount; i != 0; --i)                                 // apply LUT                            *(q++) = *(lut0 + (*(p++)));                    }                    if (lut == NULL)                                                      // use "normal" transformation                    {                        if (slope == 1.0)                        {                            for (i = this->Count; i != 0; --i)                                *(q++) = OFstatic_cast(T3, OFstatic_cast(double, *(p++)) + intercept);                        } else {                            if (intercept == 0.0)                            {                                for (i = this->InputCount; i != 0; --i)                                    *(q++) = OFstatic_cast(T3, OFstatic_cast(double, *(p++)) * slope);                            } else {                                for (i = this->InputCount; i != 0; --i)                                    *(q++) = OFstatic_cast(T3, OFstatic_cast(double, *(p++)) * slope + intercept);                            }                        }                    }                    delete[] lut;                }            }        }    }};#endif/* * * CVS/RCS Log: * $Log: dimoipxt.h,v $ * Revision 1.33  2005/12/08 16:47:51  meichel * Changed include path schema for all DCMTK header files * * Revision 1.32  2004/04/21 10:00:36  meichel * Minor modifications for compilation with gcc 3.4.0 * * Revision 1.31  2004/02/06 11:07:50  joergr * Distinguish more clearly between const and non-const access to pixel data. * * Revision 1.30  2004/01/05 14:52:20  joergr * Removed acknowledgements with e-mail addresses from CVS log. * * Revision 1.29  2003/12/23 15:53:22  joergr * Replaced post-increment/decrement operators by pre-increment/decrement * operators where appropriate (e.g. 'i++' by '++i'). * * Revision 1.28  2003/12/08 19:13:54  joergr * Adapted type casts to new-style typecast operators defined in ofcast.h. * Removed leading underscore characters from preprocessor symbols (reserved * symbols). Updated CVS header. * * Revision 1.27  2003/06/12 15:08:34  joergr * Fixed inconsistent API documentation reported by Doxygen. * * Revision 1.26  2003/06/02 17:06:21  joergr * Fixed bug in optimization criterion which caused dcmimgle to ignore the * "start frame" parameter in the DicomImage constructors under certain * circumstances. * * Revision 1.25  2002/10/21 10:13:51  joergr * Corrected wrong calculation of min/max pixel value in cases where the * stored pixel data exceeds the expected size. * * Revision 1.24  2002/06/26 16:05:43  joergr * Enhanced handling of corrupted pixel data and/or length. * * Revision 1.23  2001/11/13 18:10:43  joergr * Fixed bug occurring when processing monochrome images with an odd number of * pixels. * Fixed bug with incorrect calculation of min/max pixel values in images with * modality LUTs where not all LUT entries are used (previous optimization rule * was apparently too optimistic). * * Revision 1.22  2001/09/28 13:07:12  joergr * Added further robustness checks. * * Revision 1.21  2001/06/01 15:49:45  meichel * Updated copyright header * * Revision 1.20  2000/06/02 12:40:50  joergr * Removed debug message. * * Revision 1.19  2000/05/03 09:46:28  joergr * Removed most informational and some warning messages from release built * (#ifndef DEBUG). * * Revision 1.18  2000/04/28 12:32:31  joergr * DebugLevel - global for the module - now derived from OFGlobal (MF-safe). * * Revision 1.17  2000/04/27 13:08:39  joergr * Dcmimgle library code now consistently uses ofConsole for error output. * * Revision 1.16  2000/03/08 16:24:19  meichel * Updated copyright header. * * Revision 1.15  2000/03/03 14:09:12  meichel * Implemented library support for redirecting error messages into memory *   instead of printing them to stdout/stderr for GUI applications. * * Revision 1.14  1999/09/17 12:26:00  joergr * Added/changed/completed DOC++ style comments in the header files. * iEnhanced efficiency of some "for" loops. * * Revision 1.13  1999/07/23 14:04:35  joergr * Optimized memory usage for converting input pixel data (reference instead * of copying where possible). * * Revision 1.12  1999/05/03 15:43:20  joergr * Replaced method applyOptimizationLUT by its contents (method body) to avoid * warnings (and possible errors) on Sun CC 2.0.1 :-/ * * Revision 1.11  1999/05/03 11:09:29  joergr * Minor code purifications to keep Sun CC 2.0.1 quiet. * * Revision 1.10  1999/04/29 16:46:45  meichel * Minor code purifications to keep DEC cxx 6 quiet. * * Revision 1.9  1999/04/28 14:50:35  joergr * Introduced new scheme for the debug level variable: now each level can be * set separately (there is no "include" relationship). * * Revision 1.8  1999/03/24 17:20:10  joergr * Added/Modified comments and formatting. * * Revision 1.7  1999/03/02 12:02:27  joergr * Corrected bug: when determining minimum and maximum pixel value (external) * modality LUTs were ignored. * * Revision 1.6  1999/02/11 16:37:10  joergr * Removed inline declarations from several methods. * * Revision 1.5  1999/02/03 17:29:19  joergr * Added optimization LUT to transform pixel data. * * Revision 1.4  1999/01/20 15:06:24  joergr * Replaced invocation of getCount() by member variable Count where possible. * Added optimization to modality and VOI transformation (using additional * LUTs). * * Revision 1.3  1998/12/22 14:29:39  joergr * Replaced method copyMem by for-loop copying each item. * Renamed some variables * * Revision 1.2  1998/12/14 17:21:09  joergr * Added support for signed values as second entry in look-up tables * (= first value mapped). * * Revision 1.1  1998/11/27 15:24:08  joergr * Added copyright message. * Added new cases to optimize rescaling. * Added support for new bit manipulation class. * Corrected bug in modality LUT transformation method. * * Revision 1.5  1998/07/01 08:39:23  joergr * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional * options), e.g. add copy constructors. * * Revision 1.4  1998/05/11 14:53:21  joergr * Added CVS/RCS header to each file. * * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -