#include <vtkInfoTextImage.h>
Public Member Functions | |
vtkInfoTextImage () | |
~vtkInfoTextImage () | |
void | SetWxVtk2DBaseView (wxVtk2DBaseView *wxvtk2Dbaseview) |
void | SetMarImageData (marImageData *marimagedata) |
void | Configure () |
void | PutPixelIntensity (int x, int y, int z) |
void | PutPosition (int x, int y, int z) |
void | PutColorLevel () |
void | PutWindowLevel () |
Private Member Functions | |
vtkTextActor * | Create_Text_Label (int px, int py) |
Private Attributes | |
marImageData * | _marimagedata |
wxVtk2DBaseView * | _wxvtk2Dbaseview |
vtkTextActor * | _vtkText_WindowLevel |
vtkTextActor * | _vtkText_ColorLevel |
vtkTextActor * | _vtkText_position |
vtkTextActor * | _vtkText_pixelIntensity |
Definition at line 7 of file vtkInfoTextImage.h.
vtkInfoTextImage::vtkInfoTextImage | ( | ) |
Definition at line 9 of file vtkInfoTextImage.cxx.
References _marimagedata, _vtkText_ColorLevel, _vtkText_pixelIntensity, _vtkText_position, and _vtkText_WindowLevel.
00010 { 00011 _vtkText_WindowLevel = NULL; 00012 _vtkText_ColorLevel = NULL; 00013 _vtkText_position = NULL; 00014 _vtkText_pixelIntensity = NULL; 00015 _marimagedata = NULL; 00016 }
vtkInfoTextImage::~vtkInfoTextImage | ( | ) |
Definition at line 20 of file vtkInfoTextImage.cxx.
void vtkInfoTextImage::Configure | ( | ) |
Definition at line 26 of file vtkInfoTextImage.cxx.
References _vtkText_ColorLevel, _vtkText_pixelIntensity, _vtkText_position, _vtkText_WindowLevel, and Create_Text_Label().
Referenced by wxVtk2DBaseView::Configure(), and vtkPlane2DView::Configure().
00027 { 00028 if(_vtkText_WindowLevel == NULL){ 00029 _vtkText_WindowLevel = Create_Text_Label( 10 , 55 ); 00030 _vtkText_ColorLevel = Create_Text_Label( 10 , 40 ); 00031 _vtkText_position = Create_Text_Label( 10 , 25 ); 00032 _vtkText_pixelIntensity = Create_Text_Label( 10 , 10 ); 00033 } 00034 }
vtkTextActor * vtkInfoTextImage::Create_Text_Label | ( | int | px, | |
int | py | |||
) | [private] |
Definition at line 53 of file vtkInfoTextImage.cxx.
References _wxvtk2Dbaseview, and wxVtk2DBaseView::GetRenderer().
Referenced by Configure().
00054 { 00055 // Text Window Level 00056 vtkTextActor *textActor = vtkTextActor::New(); 00057 textActor->SetDisplayPosition(px, py); 00058 textActor->SetInput("0"); 00059 00060 // Set coordinates to match the old vtkScaledTextActor default value 00061 textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport(); 00062 textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 ); 00063 00064 vtkTextProperty *tprop = textActor->GetTextProperty(); 00065 tprop->SetFontSize(14); 00066 tprop->SetFontFamilyToArial(); 00067 tprop->SetColor(1, 1, 0); 00068 _wxvtk2Dbaseview->GetRenderer()->AddActor2D(textActor); 00069 00070 return textActor; 00071 }
void vtkInfoTextImage::PutColorLevel | ( | ) |
Definition at line 93 of file vtkInfoTextImage.cxx.
References wxVtk2DBaseView::_imageViewer2XYZ, _vtkText_ColorLevel, _wxvtk2Dbaseview, and vtkImageViewer2_XYZ::GetVtkImageViewer2().
Referenced by vtkInfoTextImageInteractorPlane2D::OnMouseMove(), and vtkInfoTextImageInteractor::OnMouseMove().
00094 { 00095 int value = (int)(_wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetLevel()); 00096 char zTzxt[20]; 00097 char resultText[50]; 00098 00099 strcpy(resultText,"c:"); 00100 00101 // itoa (value,zTzxt,10); 00102 sprintf(zTzxt,"%d",value); 00103 00104 strcat(resultText,zTzxt); 00105 _vtkText_ColorLevel -> SetInput(resultText); 00106 }
void vtkInfoTextImage::PutPixelIntensity | ( | int | x, | |
int | y, | |||
int | z | |||
) |
Definition at line 173 of file vtkInfoTextImage.cxx.
References _marimagedata, _vtkText_pixelIntensity, and marImageData::GetImageData().
Referenced by vtkInfoTextImageInteractorPlane2D::OnMouseMove(), and vtkInfoTextImageInteractor::OnMouseMove().
00174 { 00175 00176 //EEDx2 00177 bool ok=true; 00178 00179 int dim[3]; 00180 double spa[3]; 00181 vtkImageData *imagedata = _marimagedata->GetImageData(); 00182 imagedata->GetDimensions(dim); 00183 imagedata->GetSpacing(spa); 00184 00185 // EEDx7 00186 // xx=xx*(1/spa[0]); 00187 // yy=yy*(1/spa[1]); 00188 // zz=xx*spa[2]; 00189 00190 if ( (xx<0) || (xx>=dim[0]) || (yy<0) || (yy>=dim[1]) || (zz<0) || (zz>=dim[2]) ) 00191 { 00192 ok=false; 00193 } 00194 00195 00196 char zTzxt[20]; 00197 char resultText[50]; 00198 strcpy(resultText,"GL: "); 00199 if (ok==true) 00200 { 00201 if (imagedata->GetScalarType()==VTK_BIT) 00202 { 00203 char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00204 // itoa (*pOrg,zTzxt,10); 00205 if(*pOrg==0) 00206 { 00207 sprintf(zTzxt,"%d",0); 00208 } 00209 else 00210 { 00211 sprintf(zTzxt,"%d",1); 00212 } 00213 } 00214 00215 else if (imagedata->GetScalarType()==VTK_CHAR) 00216 { 00217 char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00218 // itoa (*pOrg,zTzxt,10); 00219 int tmp=*pOrg; 00220 sprintf(zTzxt,"%d",tmp); 00221 } 00222 00223 else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR) 00224 { 00225 signed char *pOrg=(signed char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00226 // itoa (*pOrg,zTzxt,10); 00227 int tmp=*pOrg; 00228 sprintf(zTzxt,"%d",tmp); 00229 } 00230 00231 else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR) 00232 { 00233 unsigned char *pOrg=(unsigned char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00234 // itoa (*pOrg,zTzxt,10); 00235 int tmp=*pOrg; 00236 sprintf(zTzxt,"%d",tmp); 00237 } 00238 00239 else if (imagedata->GetScalarType()==VTK_SHORT) 00240 { 00241 short *pOrg=(short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00242 // itoa (*pOrg,zTzxt,10); 00243 int tmp=*pOrg; 00244 sprintf(zTzxt,"%d",tmp); 00245 } 00246 00247 else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT) 00248 { 00249 unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00250 // itoa (*pOrg,zTzxt,10); 00251 int tmp=*pOrg; 00252 sprintf(zTzxt,"%d",tmp); 00253 } 00254 00255 else if (imagedata->GetScalarType()==VTK_INT) 00256 { 00257 int *pOrg=(int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00258 // itoa (*pOrg,zTzxt,10); 00259 sprintf(zTzxt,"%d",*pOrg); 00260 } 00261 00262 else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT) 00263 { 00264 unsigned int *pOrg=(unsigned int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00265 // itoa (*pOrg,zTzxt,10); 00266 int tmp=*pOrg; 00267 sprintf(zTzxt,"%d",tmp); 00268 } 00269 00270 else if (imagedata->GetScalarType()==VTK_LONG) 00271 { 00272 long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00273 // itoa (*pOrg,zTzxt,10); 00274 double tmp=*pOrg; 00275 sprintf(zTzxt,"%3.2f",tmp); 00276 } 00277 00278 else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG) 00279 { 00280 unsigned long *pOrg=(unsigned long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00281 // itoa (*pOrg,zTzxt,10); 00282 double tmp=*pOrg; 00283 sprintf(zTzxt,"%3.2f",tmp); 00284 } 00285 00286 else if (imagedata->GetScalarType()==VTK_FLOAT) 00287 { 00288 float *pOrg=(float*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00289 // itoa (*pOrg,zTzxt,10); 00290 double tmp=(double)*pOrg; 00291 sprintf(zTzxt,"%3.2f",tmp); 00292 } 00293 00294 else if (imagedata->GetScalarType()==VTK_DOUBLE) 00295 { 00296 double *pOrg=(double*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); 00297 // itoa (*pOrg,zTzxt,10); 00298 double tmp=*pOrg; 00299 sprintf(zTzxt,"%3.2f",tmp); 00300 } 00301 } 00302 else 00303 { 00304 strcpy(zTzxt,"---"); 00305 } 00306 strcat(resultText,zTzxt); 00307 _vtkText_pixelIntensity -> SetInput(resultText); 00308 }
void vtkInfoTextImage::PutPosition | ( | int | x, | |
int | y, | |||
int | z | |||
) |
Definition at line 110 of file vtkInfoTextImage.cxx.
References _marimagedata, _vtkText_position, marImageData::GetXOriginal(), marImageData::GetYOriginal(), and marImageData::GetZOriginal().
Referenced by vtkInfoTextImageInteractorPlane2D::OnMouseMove(), and vtkInfoTextImageInteractor::OnMouseMove().
00111 { 00112 00113 //EEDx7 00114 // double spa[3]; 00115 // _imagedata->GetSpacing(spa); 00116 // xx=xx*(1/spa[0]); 00117 // yy=yy*(1/spa[1]); 00118 00119 00120 char zTzxt[50]; 00121 char resultText[50]; 00122 strcpy(resultText,"p: "); 00123 // itoa ((int)xx,zTzxt,10); 00124 sprintf(zTzxt,"%d",xx); 00125 00126 strcat(resultText,zTzxt); 00127 strcat(resultText," , "); 00128 00129 // itoa ((int)yy,zTzxt,10); 00130 sprintf(zTzxt,"%d",yy); 00131 00132 strcat(resultText,zTzxt); 00133 strcat(resultText," , "); 00134 00135 // itoa ((int)zz,zTzxt,10); 00136 sprintf(zTzxt,"%d",zz); 00137 00138 strcat(resultText,zTzxt); 00139 00140 00141 00142 int nX = _marimagedata->GetXOriginal(xx); 00143 int nY = _marimagedata->GetYOriginal(yy); 00144 int nZ = _marimagedata->GetZOriginal(zz); 00145 00146 strcat(resultText," ("); 00147 // ltoa ((int)nX,zTzxt,10); 00148 sprintf(zTzxt,"%d",nX); 00149 00150 strcat(resultText,zTzxt); 00151 strcat(resultText,","); 00152 00153 // ltoa ((int)nY,zTzxt,10); 00154 sprintf(zTzxt,"%d",nY); 00155 00156 strcat(resultText,zTzxt); 00157 strcat(resultText,","); 00158 00159 // ltoa ((int)nZ,zTzxt,10); 00160 sprintf(zTzxt,"%d",nZ); 00161 00162 strcat(resultText,zTzxt); 00163 strcat(resultText,")"); 00164 00165 00166 00167 00168 _vtkText_position -> SetInput(resultText); 00169 }
void vtkInfoTextImage::PutWindowLevel | ( | ) |
Definition at line 75 of file vtkInfoTextImage.cxx.
References wxVtk2DBaseView::_imageViewer2XYZ, _vtkText_WindowLevel, _wxvtk2Dbaseview, and vtkImageViewer2_XYZ::GetVtkImageViewer2().
Referenced by vtkInfoTextImageInteractorPlane2D::OnMouseMove(), and vtkInfoTextImageInteractor::OnMouseMove().
00076 { 00077 int value = (int)( _wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetWindow() ); 00078 char zTzxt[20]; 00079 char resultText[50]; 00080 00081 strcpy(resultText,"w:"); 00082 00083 00084 //ltoa ( (long)value , zTzxt , 10 ); 00085 sprintf(zTzxt,"%d",value); 00086 00087 strcat(resultText,zTzxt); 00088 _vtkText_WindowLevel -> SetInput(resultText); 00089 }
void vtkInfoTextImage::SetMarImageData | ( | marImageData * | marimagedata | ) |
Definition at line 39 of file vtkInfoTextImage.cxx.
References _marimagedata.
Referenced by wxVtk2DBaseView::Configure(), and vtkPlane2DView::Configure().
00040 { 00041 _marimagedata=marimagedata; 00042 }
void vtkInfoTextImage::SetWxVtk2DBaseView | ( | wxVtk2DBaseView * | wxvtk2Dbaseview | ) |
Definition at line 46 of file vtkInfoTextImage.cxx.
References _wxvtk2Dbaseview.
Referenced by wxVtk2DBaseView::Configure(), and vtkPlane2DView::Configure().
00047 { 00048 _wxvtk2Dbaseview=wxvtk2Dbaseview; 00049 }
marImageData* vtkInfoTextImage::_marimagedata [private] |
Definition at line 23 of file vtkInfoTextImage.h.
Referenced by PutPixelIntensity(), PutPosition(), SetMarImageData(), and vtkInfoTextImage().
vtkTextActor* vtkInfoTextImage::_vtkText_ColorLevel [private] |
Definition at line 26 of file vtkInfoTextImage.h.
Referenced by Configure(), PutColorLevel(), and vtkInfoTextImage().
vtkTextActor* vtkInfoTextImage::_vtkText_pixelIntensity [private] |
Definition at line 28 of file vtkInfoTextImage.h.
Referenced by Configure(), PutPixelIntensity(), and vtkInfoTextImage().
vtkTextActor* vtkInfoTextImage::_vtkText_position [private] |
Definition at line 27 of file vtkInfoTextImage.h.
Referenced by Configure(), PutPosition(), and vtkInfoTextImage().
vtkTextActor* vtkInfoTextImage::_vtkText_WindowLevel [private] |
Definition at line 25 of file vtkInfoTextImage.h.
Referenced by Configure(), PutWindowLevel(), and vtkInfoTextImage().
Definition at line 24 of file vtkInfoTextImage.h.
Referenced by Create_Text_Label(), PutColorLevel(), PutWindowLevel(), and SetWxVtk2DBaseView().