00001
00002
00003
00004
00005 #include "SetHeaderDLG.h"
00006
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00014
00015 using namespace jbxl;
00016 using namespace jbxwl;
00017
00018
00020
00021
00022
00023
00024 CSetHeaderDLG::CSetHeaderDLG(CWnd* pParent) : CDialog(CSetHeaderDLG::IDD, pParent)
00025 {
00026
00027
00028
00029
00030 hSize = 0;
00031 xSize = 512;
00032 ySize = 512;
00033 zSize = 1;
00034 dSize = 16;
00035 zBase = 0;
00036
00037 ltEnd = FALSE;
00038
00039 sPara = FALSE;
00040
00041 hEBox = NULL;
00042 xEBox = NULL;
00043 yEBox = NULL;
00044 zEBox = NULL;
00045 dEBox = NULL;
00046 eCBox = NULL;
00047
00048 sCBox = NULL;
00049 bEBox = NULL;
00050 }
00051
00052
00053
00054 void CSetHeaderDLG::DoDataExchange(CDataExchange* pDX)
00055 {
00056 CDialog::DoDataExchange(pDX);
00057
00058
00059
00060
00061 }
00062
00063
00064
00065 BEGIN_MESSAGE_MAP(CSetHeaderDLG, CDialog)
00066
00067
00068 ON_BN_CLICKED(IDOK, OnBnClickedOk)
00069 ON_BN_CLICKED(IDC_FH_SAVEP, &CSetHeaderDLG::OnBnClickedFhSavep)
00070 END_MESSAGE_MAP()
00071
00072
00073
00075
00076
00077 void CSetHeaderDLG::setParameter(int h, int x, int y, int z, int d, int b, BOOL ltend, BOOL dicom)
00078 {
00079 if (!sPara) {
00080 hSize = h;
00081 xSize = x;
00082 ySize = y;
00083 zSize = z;
00084 dSize = d;
00085 }
00086 zBase = b;
00087 ltEnd = ltend;
00088
00089 }
00090
00091
00092
00093 BOOL CSetHeaderDLG::OnInitDialog()
00094 {
00095 TCHAR buf[LNAME];
00096
00097
00098 hEBox = (CEdit*)GetDlgItem(IDC_FH_HSIZE);
00099 xEBox = (CEdit*)GetDlgItem(IDC_FH_XSIZE);
00100 yEBox = (CEdit*)GetDlgItem(IDC_FH_YSIZE);
00101 zEBox = (CEdit*)GetDlgItem(IDC_FH_ZSIZE);
00102 dEBox = (CEdit*)GetDlgItem(IDC_FH_DEPTH);
00103 sCBox = (CButton*)GetDlgItem(IDC_FH_SAVEP);
00104
00105 eCBox = (CButton*)GetDlgItem(IDC_FH_LTLEND);
00106 bEBox = (CEdit*)GetDlgItem(IDC_FH_BASE);
00107
00108 sntprintf(buf, LNAME, _T("%d"), hSize);
00109 hEBox->SetWindowText(buf);
00110
00111 sntprintf(buf, LNAME, _T("%d"), xSize);
00112 xEBox->SetWindowText(buf);
00113
00114 sntprintf(buf, LNAME, _T("%d"), ySize);
00115 yEBox->SetWindowText(buf);
00116
00117 sntprintf(buf, LNAME, _T("%d"), zSize);
00118 zEBox->SetWindowText(buf);
00119
00120 sntprintf(buf, LNAME, _T("%d"), dSize);
00121 dEBox->SetWindowText(buf);
00122
00123 sntprintf(buf, LNAME, _T("%d"), zBase);
00124 bEBox->SetWindowText(buf);
00125
00126 if (sPara) sCBox->SetCheck(1);
00127 else sCBox->SetCheck(0);
00128
00129
00130
00131
00132 if (ltEnd) eCBox->SetCheck(1);
00133 else eCBox->SetCheck(0);
00134
00135 return TRUE;
00136 }
00137
00138
00139
00140 void CSetHeaderDLG::OnOK()
00141 {
00142 TCHAR buf[LNAME];
00143
00144
00145 hEBox->GetWindowText(buf, LNAME);
00146 hSize = ttoi(buf);
00147
00148 xEBox->GetWindowText(buf, LNAME);
00149 xSize = ttoi(buf);
00150
00151 yEBox->GetWindowText(buf, LNAME);
00152 ySize = ttoi(buf);
00153
00154 zEBox->GetWindowText(buf, LNAME);
00155 zSize = ttoi(buf);
00156
00157 dEBox->GetWindowText(buf, LNAME);
00158 dSize = ttoi(buf);
00159
00160 bEBox->GetWindowText(buf, LNAME);
00161 zBase = ttoi(buf);
00162
00163 if (sCBox->GetCheck()==1) sPara = TRUE;
00164 else sPara = FALSE;
00165
00166 if (eCBox->GetCheck()==1) ltEnd = TRUE;
00167 else ltEnd = FALSE;
00168
00169
00170
00171
00172
00173
00174
00175 CDialog::OnOK();
00176 return;
00177 }
00178
00179
00180
00181 CmnHead CSetHeaderDLG::getCmnHead()
00182 {
00183 CmnHead hd;
00184
00185 init_CmnHead(&hd);
00186 hd.kind = 0;
00187
00188 if (zBase!=0) {
00189 hd.kind |= HAS_BASE;
00190 ZeroBase = zBase;
00191 }
00192 if (ltEnd) hd.kind |= HAS_LENDIAN;
00193
00194
00195
00196
00197
00198
00199
00200
00201 if (sPara) {
00202 hd.kind |= USERSET_DATA;
00203 hd.xsize = xSize;
00204 hd.ysize = ySize;
00205 hd.zsize = zSize;
00206 hd.depth = dSize;
00207 hd.bsize = hSize;
00208 hd.lsize = xSize*ySize*zSize*((dSize+7)/8);
00209 }
00210
00211 return hd;
00212 }
00213
00214
00215
00216 void CSetHeaderDLG::OnBnClickedOk()
00217 {
00218
00219 OnOK();
00220 }
00221
00222
00223
00224 void CSetHeaderDLG::OnBnClickedFhSavep()
00225 {
00226
00227 }
00228