📄 ureport.cpp
字号:
//---------------------------------------------------------------------------
// 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)
//
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "uReport.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TfrmReport::TfrmReport(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmReport::SetList(TList *pList)
{
m_pList=pList;
}
//---------------------------------------------------------------------------
void __fastcall TfrmReport::Clear(void)
{
ListViewAllItems->Clear();
ListViewAbstract->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TfrmReport::SetImageInformation(TImageInformation *pImageInformation)
{
m_pImageInformation=pImageInformation;
}
//---------------------------------------------------------------------------
void __fastcall TfrmReport::CreateReport(void)
{
int i;
TListItem *pListItem;
TData *pData;
Clear();
for(i=0;i<m_pList->Count;i++)
{
pListItem=ListViewAllItems->Items->Add();
pData=(TData *)m_pList->Items[i];
pListItem->Caption=pData->Tag;
pListItem->SubItems->Add(pData->VR);
pListItem->SubItems->Add(pData->Name);
pListItem->SubItems->Add(ValueToString(pData->Value,pData->Type));
pListItem->SubItems->Add(IntToStr(pData->ValueWidth));
}
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="File Size";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageFileSize));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="File Type";
if (m_pImageInformation->bIsStandard)
{
pListItem->SubItems->Add(AnsiString("Standard DICOM"));
}
else
{
pListItem->SubItems->Add(AnsiString("Nonstandard DICOM"));
}
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Value Representation Type";
if (m_pImageInformation->bIsExplicitVR)
{
pListItem->SubItems->Add(AnsiString("Explicit Value Representation"));
}
else
{
pListItem->SubItems->Add(AnsiString("Implicit Value Representation"));
}
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Byte Ordering";
if (m_pImageInformation->bIsLittleEndian)
{
pListItem->SubItems->Add(AnsiString("Little Endian"));
}
else
{
pListItem->SubItems->Add(AnsiString("Big Endian"));
}
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Modality";
pListItem->SubItems->Add(m_pImageInformation->AsImageModality);
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Compression Type";
pListItem->SubItems->Add(ImageTypeToString(m_pImageInformation->nImageCompressionType));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Color Type";
pListItem->SubItems->Add(ColorTypeToString(m_pImageInformation->nImageColorType));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Frames";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageFrameCount));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Width";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageWidth));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Height";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageHeight));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Bits Allocated";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageBitsAllocated));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Image Bits Stored";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageBitsStored));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="High Bit";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageHighBit));
if ((m_pImageInformation->nImageSmallestPixel!=0)&&(m_pImageInformation->nImageLargestPixel!=0))
{
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Smallest Pixel";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageSmallestPixel));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Largest Pixel";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nImageLargestPixel));
}
if (m_pImageInformation->nWindowWidth>0)
{
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Window Center";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nWindowCenter));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Window Width";
pListItem->SubItems->Add(IntToStr(m_pImageInformation->nWindowWidth));
}
if ((m_pImageInformation->fRescaleSlope!=1.0)&&(m_pImageInformation->fRescaleIntercept!=0.0))
{
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Rescale Slope";
pListItem->SubItems->Add(FloatToStr(m_pImageInformation->fRescaleSlope));
pListItem=ListViewAbstract->Items->Add();
pListItem->Caption="Rescale Intercept";
pListItem->SubItems->Add(FloatToStr(m_pImageInformation->fRescaleIntercept));
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmReport::ValueToString(char *pValue,int nType)
{
if(!pValue) return AnsiString(0);
switch(nType)
{
case VR_UL:
return AnsiString(*(unsigned long *)pValue);
case VR_US:
return AnsiString(*(WORD *)pValue);
case VR_SS:
return AnsiString(*(short*)pValue);
default:
return AnsiString(pValue);
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmReport::ImageTypeToString(int nImageCompressionType)
{
switch(nImageCompressionType)
{
case IMAGE_RAW:
return AnsiString("Raw");
case IMAGE_JPEG2000:
return AnsiString("JPEG2000");
case IMAGE_JPEG2000_LOSSLESS:
return AnsiString("JPEG2000 LOSSLESS");
case IMAGE_JPEG_BASELINE:
return AnsiString("JPEG BASELINE");
case IMAGE_JPEG_EXTENDED:
return AnsiString("JPEG EXTENDED");
case IMAGE_JPEG_LOSSLESS:
return AnsiString("JPEG LOSSLESS");
case IMAGE_JPEG_LS_LOSSLESS:
return AnsiString("JPEG-LS LOSSLESS");
case IMAGE_JPEG_LS_LOSSY:
return AnsiString("JPEG-LS LOSSY");
case IMAGE_RLE:
return AnsiString("RLE");
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmReport::ColorTypeToString(int nColorType)
{
switch(nColorType)
{
case COLOR_MONOCHROME1:
return AnsiString("MONOCHROME1");
case COLOR_MONOCHROME2:
return AnsiString("MONOCHROME2");
case COLOR_RGB:
return AnsiString("RGB");
case COLOR_HSV:
return AnsiString("HSV");
case COLOR_PALETTE:
return AnsiString("PALETTE COLOR");
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -