#include <data.h>
Public Methods | |
Data () | |
~Data () | |
bool | SetPreCalc (bool pc) |
void | SetFileThreshold (int dFileThreshold) |
void | SetDataPackets (int dDataPack) |
short | GetXDim () |
short | GetYDim () |
short | GetZDim () |
int | GetHistogram (int density) |
int | GetDensity (int x, int y, int z) |
void | LoadData (char *fname) |
gradient_t | CalcGrad (int x, int y, int z) |
void | SetAbort (void) |
Public Attributes | |
string | filename |
Private Methods | |
bool | CalcDensityHistogram () |
bool | CalcGradients () |
Private Attributes | |
int | m_FileThreshold |
int | m_DataPackets |
bool | m_bAbort |
short | xDim |
short | yDim |
short | zDim |
int | xyDim |
int | size |
short * | data |
gradient_t * | gradients |
int | histogram [4096] |
bool | precalc |
|
Definition at line 42 of file data.h. References MB_TO_DATASET_THRES.
00042 { xDim = 0; 00043 yDim = 0; 00044 zDim = 0; 00045 xyDim = 0; 00046 size = 0; 00047 data = NULL; 00048 gradients = NULL; 00049 precalc = false; 00050 m_FileThreshold = 40; 00051 m_DataPackets = MB_TO_DATASET_THRES(10); 00052 m_bAbort = false; 00053 }; |
|
Definition at line 55 of file data.h.
|
|
Definition at line 36 of file data.cpp. References data, histogram, and size. Referenced by LoadData().
|
|
Definition at line 60 of file data.cpp. References CalcGradients(), GetDensity(), gradients, precalc, gradient_t::x, xDim, xyDim, gradient_t::y, yDim, gradient_t::z, and zDim. Referenced by Trilinear::CalcGradTrilinear(), and Ray::Lighting().
00060 { 00061 if(precalc && gradients == NULL) CalcGradients(); 00062 if(x < 0) x = 0; 00063 if(x > xDim-1) x = xDim-1; 00064 if(z < 0) z = 0; 00065 if(z > zDim-1) z = zDim-1; 00066 if(y < 0) y = 0; 00067 if(y > yDim-1) y = yDim-1; 00068 gradient_t res; 00069 if(!precalc) { 00070 res.x = ((float)(GetDensity(x+1,y,z) - GetDensity(x-1,y,z)))/2.0; 00071 res.y = ((float)(GetDensity(x,y+1,z) - GetDensity(x,y-1,z)))/2.0; 00072 res.z = ((float)(GetDensity(x,y,z+1) - GetDensity(x,y,z-1)))/2.0; 00073 } else { 00074 res = gradients[z*xyDim+y*xDim+x]; 00075 } 00076 return res; 00077 } |
|
Definition at line 80 of file data.cpp. References GetDensity(), gradients, xDim, xyDim, yDim, and zDim. Referenced by CalcGrad().
00080 { 00081 if (gradients != NULL) return false; 00082 gradients = new gradient_t[xDim*yDim*zDim]; 00083 00084 for(int z = 0; z < zDim; z++) { 00085 for(int y = 0; y < yDim; y++) { 00086 for(int x = 0; x < xDim; x++) { 00087 gradients[z*xyDim+y*xDim+x].x = ((float)(GetDensity(x+1,y,z) - GetDensity(x-1,y,z)))/2.0; 00088 gradients[z*xyDim+y*xDim+x].y = ((float)(GetDensity(x,y+1,z) - GetDensity(x,y-1,z)))/2.0; 00089 gradients[z*xyDim+y*xDim+x].z = ((float)(GetDensity(x,y,z+1) - GetDensity(x,y,z-1)))/2.0; 00090 } 00091 } 00092 } 00093 00094 return true; 00095 } |
|
Definition at line 24 of file data.cpp. References data, xDim, xyDim, yDim, and zDim. Referenced by Trilinear::CalcAlphaTrilinear(), Trilinear::CalcColorTrilinear(), CalcGrad(), CalcGradients(), AverageNN::CastNext(), XRayNN::CastNext(), MaxIntensityNN::CastNext(), FirstHitNN::CastNext(), Ray::CastNext(), FirstHitTRI::GetDensity(), and Slice::SetPixels().
|
|
Definition at line 52 of file data.cpp. References histogram. Referenced by transferfuncform::m_DrawHistogram().
00053 { 00054 if(density < 0) density = 0; 00055 if(density >= 4096) density = 4095; 00056 return histogram[density]; 00057 } |
|
Definition at line 198 of file data.cpp. References xDim. Referenced by Slice::GetSliceNumber(), Perspective::Initialize(), Raycaster::Initialize(), Ray::Initialize(), Perspective::RotateX(), Raycaster::RotateX(), Perspective::RotateY(), Raycaster::RotateY(), Perspective::RotateZ(), Raycaster::RotateZ(), Slice::SetPixels(), Raycaster::SetViewingPlanePos(), and Raycaster::Zoom().
00199 { 00200 return xDim; 00201 } |
|
Definition at line 204 of file data.cpp. References yDim. Referenced by Slice::GetSliceNumber(), Perspective::Initialize(), Raycaster::Initialize(), Ray::Initialize(), Perspective::RotateX(), Raycaster::RotateX(), Perspective::RotateY(), Raycaster::RotateY(), Perspective::RotateZ(), Raycaster::RotateZ(), Slice::SetPixels(), Raycaster::SetViewingPlanePos(), and Raycaster::Zoom().
00205 { 00206 return yDim; 00207 } |
|
Definition at line 210 of file data.cpp. References zDim. Referenced by Slice::GetSliceNumber(), Perspective::Initialize(), Raycaster::Initialize(), Ray::Initialize(), Perspective::RotateX(), Raycaster::RotateX(), Perspective::RotateY(), Raycaster::RotateY(), Perspective::RotateZ(), Raycaster::RotateZ(), Slice::SetPixels(), Raycaster::SetViewingPlanePos(), and Raycaster::Zoom().
00211 { 00212 return zDim; 00213 } |
|
Definition at line 99 of file data.cpp. References CalcDensityHistogram(), data, DATASET_TO_MB, filename, m_bAbort, m_DataPackets, m_FileThreshold, size, xDim, xyDim, yDim, and zDim.
00100 { 00101 00102 char *filename = (char *)fname; 00103 00104 FILE *filePtr; 00105 00106 // open File 00107 filePtr = fopen(filename, "rb"); 00108 if(!filePtr) return;// false; 00109 00110 //getting headerinfo 00111 fread(&xDim, sizeof(short),1,filePtr); 00112 fread(&yDim, sizeof(short),1,filePtr); 00113 fread(&zDim, sizeof(short),1,filePtr); 00114 00115 xyDim = (int)xDim*yDim; 00116 00117 00118 size = xyDim * zDim; 00119 data = new short[size]; 00120 00121 00122 CWnd* pFrame = AfxGetMainWnd(); 00123 00124 int loadSize = (size) / 100; 00125 int counter = loadSize; 00126 int pos = 0; 00127 int fileSize = 0; 00128 00129 /* 00130 size means the size in data-sets!! 00131 partially loading if approx filesize is greater than 40MB 00132 (size * 16) / 8 / 1024 / 1024 = (size >> 19) 00133 */ 00134 if ((m_FileThreshold != 0) && 00135 (fileSize = DATASET_TO_MB(size)) >= m_FileThreshold) { 00136 int pieces = size / m_DataPackets; 00137 00138 00139 00140 00141 pFrame->SendMessage(MYWM_PROGRESS_MIN_MAX, 0, pieces); 00142 00143 int tempSize = size; 00144 00145 for (int i = 0; i < pieces; i++) { 00146 pFrame->SendMessage(MYWM_PROGRESS, i); 00147 fread(data + i * m_DataPackets, sizeof(short), m_DataPackets, filePtr); 00148 tempSize -= m_DataPackets; 00149 } 00150 00151 pFrame->SendMessage(MYWM_PROGRESS, i); 00152 if (tempSize > 0) 00153 fread(data + i * m_DataPackets, sizeof(short), tempSize, filePtr); 00154 } 00155 else { 00156 fread(data,sizeof(short),size,filePtr); 00157 } 00158 00159 fclose(filePtr); 00160 00161 pFrame->SendMessage(MYWM_PROGRESS_MIN_MAX, 0, 100); 00162 00163 //only 12 bit of data are used for each voxel (4096 density values) 00164 for(int z=0; z < zDim; z++) { 00165 for(int y=0; y < yDim; y++) { 00166 for(int x=0; x < xDim; x++) { 00167 data[z*xyDim+y*xDim+x] &= 0x0fff; 00168 00169 //progressbar 00170 if (counter-- <= 0) { 00171 counter = loadSize; 00172 pFrame->SendMessage(MYWM_PROGRESS, pos++); 00173 } 00174 } 00175 } 00176 00177 if (m_bAbort) { 00178 if (data) 00179 delete[] data; 00180 00181 m_bAbort = false; 00182 return; 00183 } 00184 00185 } 00186 00187 pFrame->SendMessage(MYWM_PROGRESS, 0); 00188 00189 00190 this->filename = filename; 00191 00192 if(!CalcDensityHistogram()) return;// false; 00193 00194 // return true; 00195 } |
|
Definition at line 70 of file data.h.
00070 { m_bAbort = true; }; |
|
Definition at line 58 of file data.h. References MB_TO_DATASET_THRES.
00058 { m_DataPackets = MB_TO_DATASET_THRES(dDataPack); }; |
|
Definition at line 57 of file data.h.
00057 { m_FileThreshold = dFileThreshold; }; |
|
Definition at line 56 of file data.h. Referenced by Perspective::Raycast(), and Raycaster::Raycast().
00056 { precalc = pc; return true;} |
|
Definition at line 35 of file data.h. Referenced by CalcDensityHistogram(), GetDensity(), and LoadData(). |
|
Definition at line 68 of file data.h. Referenced by LoadData(). |
|
Definition at line 36 of file data.h. Referenced by CalcGrad(), and CalcGradients(). |
|
Definition at line 38 of file data.h. Referenced by CalcDensityHistogram(), and GetHistogram(). |
|
Definition at line 29 of file data.h. Referenced by LoadData(). |
|
Definition at line 27 of file data.h. Referenced by LoadData(). |
|
Definition at line 25 of file data.h. Referenced by LoadData(). |
|
Definition at line 39 of file data.h. Referenced by CalcGrad(). |
|
Definition at line 34 of file data.h. Referenced by CalcDensityHistogram(), and LoadData(). |
|
Definition at line 32 of file data.h. Referenced by CalcGrad(), CalcGradients(), GetDensity(), GetXDim(), and LoadData(). |
|
Definition at line 33 of file data.h. Referenced by CalcGrad(), CalcGradients(), GetDensity(), and LoadData(). |
|
Definition at line 32 of file data.h. Referenced by CalcGrad(), CalcGradients(), GetDensity(), GetYDim(), and LoadData(). |
|
Definition at line 32 of file data.h. Referenced by CalcGrad(), CalcGradients(), GetDensity(), GetZDim(), and LoadData(). |