00001 #include <iostream>
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include <glut.h>
00005 #include "lifevariables.h"
00006 #include "CDensities.h"
00007
00008
00009 void CDensities::InitDensities_XY_plain_by_Slice(int iSliceNum)
00010 {
00011 unsigned short * pD = _pDensities;
00012 unsigned short dimX, dimY;
00013 int i,j;
00014
00015 dimX = GVolVoxels.GetDimX();
00016 dimY = GVolVoxels.GetDimY();
00017
00018 for ( j = 0; j < dimY; j++ )
00019 for ( i = 0; i < dimX; i++, pD++ )
00020 {
00021 (*pD) = GVolVoxels.GetVoxelValue(i,j,iSliceNum);
00022 }
00023 }
00024
00025
00026 void CDensities::InitDensities_XZ_plain_by_Slice(int iSliceNum)
00027 {
00028 unsigned short * pD = _pDensities;
00029 unsigned short dimX, dimZ;
00030 int i,j;
00031
00032 dimX = GVolVoxels.GetDimX();
00033 dimZ = GVolVoxels.GetDimZ();
00034
00035 for ( j = 0; j < dimZ; j++ )
00036 {
00037 for ( i = 0; i < dimX; i++, pD++ )
00038 {
00039 (*pD) = GVolVoxels.GetVoxelValue(i,iSliceNum,j);
00040 }
00041 }
00042 }
00043
00044
00045 void CDensities::InitDensities_YZ_plain_by_Slice(int iSliceNum)
00046 {
00047 unsigned short * pD = _pDensities;
00048 unsigned short dimY, dimZ;
00049 int i,j;
00050
00051 dimY = GVolVoxels.GetDimY();
00052 dimZ = GVolVoxels.GetDimZ();
00053
00054 for ( j = 0; j < dimZ; j++ )
00055 for ( i = 0; i < dimY; i++, pD++ )
00056 {
00057 (*pD) = GVolVoxels.GetVoxelValue(iSliceNum,i,j);
00058 }
00059 }
00060
00061 unsigned short CDensities::GetMaxValue()
00062 {
00063 unsigned uNewVal = 0;
00064 unsigned uMaxCount = _dimX * _dimY;
00065
00066
00067 for ( int i = 0; i < uMaxCount; i++ )
00068 {
00069 if ( uNewVal < _pDensities[i] )
00070 {
00071 uNewVal = _pDensities[i];
00072 }
00073 }
00074
00075 return uNewVal;
00076 }