-
大小: 902.26 KB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2024-09-16
- 語(yǔ)言: 其他
- 標(biāo)簽:
資源簡(jiǎn)介
DICOM圖像的讀取以及窗寬,窗位調(diào)整,挺不錯(cuò)的!
代碼片段和文件信息
/******************************************************************
CqOctree.CPP
??Performing?Color?Quantization?using?Octree?algorithm
??The?2?functions?for?global?use?is
??HPALETTE?CreateOctreePalette?(HBITMAP?hImage?UINT?nMaxColors?UINT?nColorBits)
??HPALETTE?CreateOctreePalette?(LPSTR?lpDIB?UINT?nMaxColors?UINT?nColorBits)
??For?using?convenience?define?it?in?DIBAPI.H
******************************************************************/
#include?“stdafx.h“
#include?“dibapi.h“
//?structure?use?internally
//?store?the?necessary?info?of?a?node?in?octree
typedef?struct?_NODE?
{
????BOOL?bIsLeaf;???????????????//?TRUE?if?node?has?no?children
????UINT?nPixelCount;???????????//?Number?of?pixels?represented?by?this?leaf
????UINT?nRedSum;???????????????//?Sum?of?red?components
????UINT?nGreenSum;?????????????//?Sum?of?green?components
????UINT?nBlueSum;??????????????//?Sum?of?blue?components
????struct?_NODE*?pChild[8];????//?Pointers?to?child?nodes
????struct?_NODE*?pNext;????????//?Pointer?to?next?reducible?node
}?NODE;
//?Function?prototypes
//Global?use?define?it?in?dibapi.h
//HPALETTE?CreateOctreePalette?(HDIB?hDIB?UINT?nMaxColors?UINT?nColorBits)
//HPALETTE?CreateOctreePalette?(LPSTR?lpDIB?UINT?nMaxColors?UINT?nColorBits)
//Local?use?only
HPALETTE?BuildOctreePalette(HANDLE?hImage?UINT?nMaxColors?UINT?nColorBits);
void?AddColor?(NODE**?BYTE?BYTE?BYTE?UINT?UINT?UINT*?NODE**);
NODE*?CreateNode?(UINT?UINT?UINT*?NODE**);
void?ReduceTree?(UINT?UINT*?NODE**);
void?DeleteTree?(NODE**);
void?GetPaletteColors?(NODE*?PALETTEENTRY*?UINT*);
int?GetRightShiftCount?(DWORD);
int?GetLeftShiftCount?(DWORD);
//?Function?body
/*************************************************************************?
?*?
?*?CreateOctreePalette()?
?*?
?*?Parameters:?
?*?
?*?HDIB?hDIB????????-?Handle?to?source?DIB?
?*?UINT?nMaxColors??-?destination?color?number
?*?UINT?nColorBits??-?destination?color?bits
?*?
?*?Return?Value:?
?*?
?*?HPALETTE?????????-?Handle?to?the?result?palette
?*?
?*?Description:?
?*?
?*?This?function?use?Octree?color?quantization?algorithm?to?get
?*?optimal?m?kinds?of?color?to?represent?total?n?kinds?of?color?
?*?in?a?DIB?and?use?the?m?kinds?of?color?to?build?a?palette.
?*?With?the?palette?we?can?display?the?DIB?on?reasonable?accuracy.
?*?
?************************************************************************/?
HPALETTE?CreateOctreePalette(HDIB?hDIB?UINT?nMaxColors?UINT?nColorBits)
{
HANDLE?hImage;
hImage?=?DIBToDIBSection(hDIB);
if?(!?hImage)
return?NULL;
return?BuildOctreePalette(hImage?nMaxColors?nColorBits);
}
/*************************************************************************?
?*?
?*?CreateOctreePalette()?
?*?
?*?Parameters:?
?*?
?*?LPBYTE?lpDIB?????-?Pointer?to?DIB?data?buffer
?*?UINT?nMaxColors??-?destination?color?number
?*?UINT?nColorBits??-?destination?color?bits
?*?
?*?Return?Value:?
?*?
?*?HPALETTE???????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????196311??2005-04-12?14:20??dibapi.cpp
?????文件???????7929??2001-11-15?23:34??dibapi.h
?????文件??????36456??2006-10-10?08:56??DicomRead.aps
?????文件???????1540??2006-10-10?08:56??DicomRead.clw
?????文件???????2105??2006-08-02?10:10??DicomRead.cpp
?????文件???????5194??2006-08-02?15:15??DicomRead.dsp
?????文件????????541??2006-08-02?10:10??DicomRead.dsw
?????文件???????1357??2006-08-02?10:10??DicomRead.h
?????文件?????140288??2006-10-10?08:56??DicomRead.ncb
?????文件??????56832??2006-10-10?08:56??DicomRead.opt
?????文件???????1185??2006-10-10?08:56??DicomRead.plg
?????文件???????6193??2006-10-10?08:56??DicomRead.rc
?????文件??????13191??2006-08-30?09:37??DicomReadDlg.cpp
?????文件???????2155??2006-08-30?09:11??DicomReadDlg.h
?????文件??????51050??2001-11-21?00:12??IP.cpp
?????文件?????238698??2000-01-31?17:28??Jpeglib2.lib
?????文件???????3633??2006-08-02?10:10??ReadMe.txt
?????文件????????963??2006-10-10?08:56??resource.h
?????文件????????211??2006-08-02?10:10??StdAfx.cpp
?????文件???????1054??2006-08-02?10:10??StdAfx.h
?????文件????5447754??2006-10-10?08:56??Debug\DicomRead.exe
?????目錄??????????0??2006-10-10?08:56??Debug
?????文件???????1078??2006-08-02?10:10??res\DicomRead.ico
?????文件????????401??2006-08-02?10:10??res\DicomRead.rc2
?????目錄??????????0??2006-08-02?10:10??res
?????文件??????14512??2001-11-06?00:53??CqOctree.cpp
?????文件??????55339??2006-08-29?23:04??Dib.cpp
?????文件???????6154??2006-08-29?22:54??Dib.h
-----------?---------??----------?-----??----
??????????????6292124????????????????????28
............此處省略1個(gè)文件信息
評(píng)論
共有 條評(píng)論