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