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

📄 ucommon.h

📁 dicom file 查看工具 DICOM文件是医疗设备使用的文件格式。
💻 H
字号:
//---------------------------------------------------------------------------
// This file is part of Dicom Explorer, see http://www.sourceforge.net/projects/dcmsee
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.                                 
// 
// This software is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Liu Jie (liucoldstar@yahoo.com)
//
//---------------------------------------------------------------------------

#ifndef COMMON_H
#define COMMON_H

#include <vcl.h>

#define VR_AE                       0x4541
#define VR_AS                       0x5341
#define VR_AT                       0x5441
#define VR_BW                       0x5742
#define VR_CS                       0x5343
#define VR_DA                       0x4144
#define VR_DS                       0x5344
#define VR_DT                       0x5444
#define VR_FD                       0x4446
#define VR_FL                       0x4C46
#define VR_IS                       0x5349
#define VR_LO                       0x4f4c
#define VR_LT                       0x544c
#define VR_OB                       0x424f
#define VR_OF                       0x464f
#define VR_OW                       0x574f
#define VR_PN                       0x4e50
#define VR_RE                       0x4552
#define VR_SH                       0x4853
#define VR_SI                       0x4953
#define VR_SL                       0x4C53
#define VR_SQ                       0x5153
#define VR_SS                       0x5353
#define VR_ST                       0x5453
#define VR_SW                       0x5753
#define VR_TM                       0x4d54
#define VR_UI                       0x4955
#define VR_UL                       0x4C55
#define VR_US                       0x5355
#define VR_UT                       0x5455
#define VR_UN                       0x4e55
#define VR_NO                       0x4f4e


#define IMAGE_RAW                   0
#define IMAGE_JPEG2000              1
#define IMAGE_JPEG2000_LOSSLESS     2
#define IMAGE_JPEG_BASELINE         3
#define IMAGE_JPEG_EXTENDED         4
#define IMAGE_JPEG_LOSSLESS         5
#define IMAGE_JPEG_LS_LOSSLESS      6
#define IMAGE_JPEG_LS_LOSSY         7
#define IMAGE_RLE                   8

#define MODALITY_CR                 0x5243       //Computed Radiography
#define MODALITY_CT                 0x5443       //Computed Tomography
#define MODALITY_MR                 0x524d       //Magnetic Resonance
#define MODALITY_NM                 0x4d4e       //Nuclear Medicine
#define MODALITY_US                 0x5355       //Ultrasound
#define MODALITY_OT                 0x544f       //Other
#define MODALITY_BI                 0x4942       //Biomagnetic imaging
#define MODALITY_CD                 0x4443       //Color flow Doppler
#define MODALITY_DD                 0x4444       //Duplex Doppler
#define MODALITY_DG                 0x4744       //Diaphanography
#define MODALITY_ES                 0x5345       //Endoscopy
#define MOdALITY_LS                 0x534c       //Laser surface scan

#define VALUE_WORD                  2
#define VALUE_DWORD                 4

#define COLOR_MONOCHROME1           1
#define COLOR_MONOCHROME2           2
#define COLOR_RGB                   3
#define COLOR_HSV                   4
#define COLOR_PALETTE               5

#define ERROR_IO                    1
#define ERROR_NOT_STANDARD          2
#define ERROR_MEM                   3
#define ERROR_DATASET               4

//---------------------------------------------------------------------------
class TImageInformation
{
public:
  bool bIsStandard;
  bool bIsExplicitVR;
  bool bIsLittleEndian;
  AnsiString AsImageModality;

  int nImageFileSize;
  TList *pImageSlicePos;
  int nImageCompressionType;
  int nImageColorType;
  unsigned int nImageWidth;
  unsigned int nImageHeight;
  int nImageDepth;
  unsigned int nImageFrameCount;
  unsigned int nImageBitsAllocated;
  unsigned int nImageBitsStored;
  unsigned int nImageHighBit;
  int nImageSmallestPixel;
  unsigned int nImageLargestPixel;
  int nWindowCenter;
  int nWindowWidth;

  float fRescaleIntercept;
  float fRescaleSlope;
public:
  TImageInformation()
  {
    pImageSlicePos=NULL;
    Clear();
  }
  void Clear(void)
  {
    int i,nCount;
    int *pItem=NULL;

    bIsStandard=true;
    bIsExplicitVR=true;
    bIsLittleEndian=true;
    nImageFileSize=-1;
    
    if(pImageSlicePos)
    {
      nCount=pImageSlicePos->Count;
      for (i=0;i<nCount;i++)
      {
        pItem=(int *)pImageSlicePos->Items[i];
        delete pItem;
      }
      delete pImageSlicePos;
    }
    pImageSlicePos=new TList;

    nImageCompressionType=IMAGE_RAW;
    nImageColorType=-1;
    nImageWidth=-1;
    nImageHeight=-1;
    nImageDepth=-1;
    nImageFrameCount=1;
    
    nImageBitsAllocated=-1;
    nImageBitsStored=-1;
    nImageHighBit=-1;

    nImageSmallestPixel=0;
    nImageLargestPixel=0;

    //nWindowCenter=-1;
    nWindowWidth=-1;

    fRescaleIntercept=0.0;
    fRescaleSlope=1.0;
  }
  ~TImageInformation()
  {
    int i,nCount;
    int *pItem;
    
    if(pImageSlicePos)
    {
      nCount=pImageSlicePos->Count;
      for (i=0;i<nCount;i++)
      {
        pItem=(int *)pImageSlicePos->Items[i];
        delete pItem;
      }
      delete pImageSlicePos;
    }
  }
};

//---------------------------------------------------------------------------
class TData
{
public:
  AnsiString Tag;
  int Type;
  AnsiString VR;
  bool IsRetired;
  AnsiString Name;
  char *Value;
  int ValueWidth;
  int TagCode;
public:
  TData()
  {
    Value=NULL;
    ValueWidth=0;
    IsRetired=false;
  }
  ~TData()
  {
    if (Value) delete []Value;
  }
};
//---------------------------------------------------------------------------

#endif

⌨️ 快捷键说明

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