Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Slice Class Reference

#include <slice.h>

List of all members.

Public Types

enum  { XY, XZ, YZ }

Public Methods

 Slice ()
 slice.cpp erstellt slice-view für die drei Hauptebenen

 ~Slice ()
bool SetType (int tp)
int GetType ()
int GetSliceNumber (Data *dat=NULL)
void SetTransferfunction (Transfunc *transferfunction)
bool SetPixels (Data *dat, int dp)
void SetZoom (bool zoom)
bool GetZoom ()
void SetTransfer (bool transfer)
bool GetTransfer ()
bool SetPixels (Transfunc *tf, Data *dat, int dp)
bool DrawSlice (int width, int height)
void GetImageInfo (int &width, int &height, int &x, int &y, int &plane, int &depth)
rgbGetScreenShotImage (int &width, int &height)

Private Attributes

int m_depth
int m_type
int m_x
int m_y
int m_width
int m_height
rgbslice_data
bool m_bZoom
bool m_bUseTransfer
int m_dSliceNumber
Transfuncm_tTransferfunction


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
XY 
XZ 
YZ 

Definition at line 27 of file slice.h.

00027 { XY, XZ, YZ };


Constructor & Destructor Documentation

Slice::Slice  
 

slice.cpp erstellt slice-view für die drei Hauptebenen

Definition at line 5 of file slice.cpp.

References m_bUseTransfer, m_bZoom, m_depth, m_dSliceNumber, m_height, m_tTransferfunction, m_type, m_width, and slice_data.

00006 {
00007         m_depth=0;
00008         m_height=0;
00009         m_width=0;
00010         m_type=0; // xy Plane as default value
00011         slice_data = NULL;
00012         m_dSliceNumber = -1;
00013         m_bZoom = false;
00014         m_bUseTransfer = false;
00015         m_tTransferfunction = NULL;
00016 }

Slice::~Slice  
 

Definition at line 19 of file slice.cpp.

References slice_data.

00020 {
00021         if(slice_data != NULL) delete slice_data;
00022 }


Member Function Documentation

bool Slice::DrawSlice int    width,
int    height
 

Definition at line 158 of file slice.cpp.

References m_bZoom, m_height, m_width, m_x, m_y, and slice_data.

Referenced by CMy3dvisView::RenderScene().

00159 {
00160         float zoomx = (float)width / (float)m_width;
00161         float zoomy = (float)height / (float)m_height;
00162         float zoom;
00163 
00164 
00165         if (zoomx < zoomy) {
00166                 zoom = zoomx;
00167                 m_x = 0;
00168                 m_y = height / 2 - (m_height * zoom) / 2;
00169         }
00170         else {
00171                 zoom = zoomy;
00172                 m_y = 0;
00173                 m_x = width / 2 - (m_width * zoom) / 2;
00174         }
00175 
00176 
00177         if (!m_bZoom) {
00178                 zoom = 1.0f;
00179                 m_x = width / 2 - m_width / 2;
00180                 m_y = height / 2 - m_height / 2;
00181         }
00182 
00183 
00184         if(slice_data == NULL) return false;
00185         glRasterPos2i(m_x, m_y);
00186         glPixelStorei(GL_UNPACK_ALIGNMENT,1);
00187         glPixelZoom(zoom, zoom);
00188         glDrawPixels(m_width, m_height, GL_RGB, GL_UNSIGNED_BYTE, slice_data);
00189         return true;
00190 }

void Slice::GetImageInfo int &    width,
int &    height,
int &    x,
int &    y,
int &    plane,
int &    depth
 

Definition at line 195 of file slice.cpp.

References m_depth, m_height, m_type, m_width, m_x, and m_y.

00195                                                                                         {
00196         width = m_width;
00197         height = m_height;
00198         x = m_x;
00199         y = m_y;
00200         plane = m_type;
00201         depth = m_depth;
00202 }

rgb* Slice::GetScreenShotImage int &    width,
int &    height
[inline]
 

Definition at line 48 of file slice.h.

Referenced by CMy3dvisView::OnFileSaveImage().

00048                                                          { width = m_width;
00049                                                                                                                 height = m_height;
00050                                                                                                                 return slice_data; };

int Slice::GetSliceNumber Data   dat = NULL
 

Definition at line 39 of file slice.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_dSliceNumber, XY, XZ, and YZ.

Referenced by dialogbar::OnShowWindow().

00039                                    {
00040         if (dat == NULL)
00041                 return m_dSliceNumber;
00042 
00043         switch (m_type) {
00044                 case XY:
00045                         m_dSliceNumber = dat->GetZDim() - 1;
00046                         break;
00047                 case XZ:
00048                         m_dSliceNumber = dat->GetYDim() - 1;
00049                         break;
00050                 case YZ:
00051                         m_dSliceNumber = dat->GetXDim() - 1;
00052                         break;
00053         }
00054         return m_dSliceNumber;
00055 }

bool Slice::GetTransfer   [inline]
 

Definition at line 43 of file slice.h.

Referenced by dialogbar::OnCheckUseTransfer().

00043 { return m_bUseTransfer; }

int Slice::GetType  
 

Definition at line 33 of file slice.cpp.

References m_type.

00034 {
00035         return m_type;
00036 }

bool Slice::GetZoom   [inline]
 

Definition at line 40 of file slice.h.

Referenced by dialogbar::OnCheckZoom().

00040 { return m_bZoom; }

bool Slice::SetPixels Transfunc   tf,
Data   dat,
int    dp
 

Definition at line 59 of file slice.cpp.

References rgb::b, CLAMP0255, rgb::g, Data::GetDensity(), Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_bUseTransfer, m_depth, m_height, m_type, m_width, rgb::r, slice_data, XY, XZ, and YZ.

00060 {
00061         if (m_bUseTransfer && tf == NULL)
00062                 m_bUseTransfer = false;
00063 
00064         int size = 0;
00065         if(slice_data != NULL) delete slice_data;
00066         m_depth = dp;
00067         int density;
00068     
00069         if(m_type == XY)
00070         {                                                                                               // XY Plane
00071                 m_width = (int)dat->GetXDim();
00072                 m_height = (int)dat->GetYDim();
00073                 size = m_width*m_height;
00074                 slice_data = new rgb[size];
00075                 for(int i = 0; i < m_height; i++)
00076                 {
00077                         for(int j = 0; j < m_width; j++)
00078                         {
00079                                 if (m_bUseTransfer) {
00080                                         density = dat->GetDensity(j,i,m_depth);
00081                                         slice_data[i*m_width+j] = tf->GetDensityColor(density);
00082                                 }
00083                                 else {
00084                                         density = dat->GetDensity(j, i, m_depth) / 16;
00085                                         density = CLAMP0255(density);
00086                                         rgb col;
00087                                         col.r = density;
00088                                         col.g = density;
00089                                         col.b = density;
00090                                         slice_data[i * m_width + j] = col;
00091                                 }
00092                         }
00093                 }
00094         }
00095         
00096         if(m_type == XZ)
00097         {                                                                                               // XZ Plane 
00098                 m_width = dat->GetXDim();
00099                 m_height = dat->GetZDim();
00100                 size = m_width*m_height;
00101                 slice_data = new rgb[size];
00102                 for(int i = 0; i < m_height; i++)
00103                 {
00104                         for(int j = 0; j < m_width; j++)
00105                         {
00106                                 if (m_bUseTransfer) {
00107                                         density = dat->GetDensity(j,m_depth,i);
00108                                         slice_data[i*m_width+j] = tf->GetDensityColor(density);
00109                                 }
00110                                 else {
00111                                         density = dat->GetDensity(j, m_depth, i) / 16;
00112                                         density = CLAMP0255(density);
00113                                         rgb col;
00114                                         col.r = density;
00115                                         col.g = density;
00116                                         col.b = density;
00117                                         slice_data[i * m_width + j] = col;
00118                                 }
00119                         }
00120                 }
00121         }
00122         
00123         if(m_type == YZ)
00124         {                                                                                               //YZ Plane
00125                 m_width = dat->GetYDim();
00126                 m_height = dat->GetZDim();
00127                 size = m_width*m_height;
00128                 slice_data = new rgb[size];
00129                 for(int i = 0; i < m_height; i++)
00130                 {
00131                         for(int j = 0; j < m_width; j++)
00132                         {
00133                                 if (m_bUseTransfer) {
00134                                         density = dat->GetDensity(m_depth,j,i);
00135                                         slice_data[i*m_width+j] = tf->GetDensityColor(density);
00136                                 }
00137                                 else {
00138                                         density = dat->GetDensity(m_depth, j, i) / 16;
00139                                         density = CLAMP0255(density);
00140                                         rgb col;
00141                                         col.r = density;
00142                                         col.g = density;
00143                                         col.b = density;
00144                                         slice_data[i * m_width + j] = col;
00145                                 }
00146                         }
00147                 }
00148         }
00149 
00150         return true;
00151 }

bool Slice::SetPixels Data   dat,
int    dp
[inline]
 

Definition at line 37 of file slice.h.

Referenced by ON_BN_CLICKED(), dialogbar::OnCheckUseTransfer(), dialogbar::OnHScroll(), dialogbar::OnRadioXz(), dialogbar::OnRadioYz(), and dialogbar::OnShowWindow().

00037 { return SetPixels(m_tTransferfunction, dat, dp == -1 ? m_depth : dp); }

void Slice::SetTransfer bool    transfer [inline]
 

Definition at line 42 of file slice.h.

Referenced by dialogbar::OnCheckUseTransfer().

00042 { m_bUseTransfer = transfer; }

void Slice::SetTransferfunction Transfunc   transferfunction [inline]
 

Definition at line 36 of file slice.h.

00036 { m_tTransferfunction = transferfunction; }

bool Slice::SetType int    tp
 

Definition at line 25 of file slice.cpp.

References m_type.

Referenced by ON_BN_CLICKED(), dialogbar::OnRadioXz(), and dialogbar::OnRadioYz().

00026 {
00027         if ((tp < 0)||(tp > 2)) return false;
00028         m_type = tp;
00029         return true;
00030 }

void Slice::SetZoom bool    zoom [inline]
 

Definition at line 39 of file slice.h.

Referenced by dialogbar::OnCheckZoom().

00039 { m_bZoom = zoom; }


Member Data Documentation

bool Slice::m_bUseTransfer [private]
 

Definition at line 20 of file slice.h.

Referenced by SetPixels(), and Slice().

bool Slice::m_bZoom [private]
 

Definition at line 19 of file slice.h.

Referenced by DrawSlice(), and Slice().

int Slice::m_depth [private]
 

Definition at line 13 of file slice.h.

Referenced by GetImageInfo(), SetPixels(), and Slice().

int Slice::m_dSliceNumber [private]
 

Definition at line 21 of file slice.h.

Referenced by GetSliceNumber(), and Slice().

int Slice::m_height [private]
 

Definition at line 16 of file slice.h.

Referenced by DrawSlice(), GetImageInfo(), SetPixels(), and Slice().

Transfunc* Slice::m_tTransferfunction [private]
 

Definition at line 22 of file slice.h.

Referenced by Slice().

int Slice::m_type [private]
 

Definition at line 14 of file slice.h.

Referenced by GetImageInfo(), GetType(), SetPixels(), SetType(), and Slice().

int Slice::m_width [private]
 

Definition at line 16 of file slice.h.

Referenced by DrawSlice(), GetImageInfo(), SetPixels(), and Slice().

int Slice::m_x [private]
 

Definition at line 15 of file slice.h.

Referenced by DrawSlice(), and GetImageInfo().

int Slice::m_y [private]
 

Definition at line 15 of file slice.h.

Referenced by DrawSlice(), and GetImageInfo().

rgb* Slice::slice_data [private]
 

Definition at line 17 of file slice.h.

Referenced by DrawSlice(), SetPixels(), Slice(), and ~Slice().


The documentation for this class was generated from the following files:
Generated on Thu Jan 30 21:35:44 2003 for 3DVis by doxygen1.3-rc2