/usr/include/gofigure2/vtkViewImage.h is in libgofigure-dev 0.9.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | /*========================================================================
Copyright (c) INRIA - ASCLEPIOS Project (http://www-sop.inria.fr/asclepios).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of INRIA or ASCLEPIOS, nor the names of any contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/*=========================================================================
Modifications were made by the GoFigure Dev. Team.
while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
Copyright (c) 2009-11, President and Fellows of Harvard College.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the President and Fellows of Harvard College
nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _vtkViewImage_h_
#define _vtkViewImage_h_
#include "MegaVTK2Configure.h"
#include "vtkImageViewer2.h"
#include <vtkRenderer.h>
#include <vtkTextProperty.h>
#include <vtkCornerAnnotation.h>
#include <vtkActor.h>
#include <vtkDataSet.h>
#include <vector>
/**
This macro can be useful as we frequently set
an instance this way, meaning unregistering previously set instance,
registering given instance, and call a modified event.
However this might be not the best place to define it...
*/
//BTX
#define vtkSetObjectMacro2Body(object, type, _arg) \
if ( this->object == _arg ) { return; } \
if ( this->object ) \
{ \
this->object->UnRegister(this); \
} \
this->object = _arg; \
\
if ( this->object != NULL ) \
{ \
this->object->Register(this); \
} \
\
this->Modified(); \
//ETX
/**
This macro can be useful as we frequently set
an instance this way, meaning unregistering previously set instance,
registering given instance, and call a modified event.
However this might be not the best place to define it...
*/
//BTX
#define vtkSetObjectMacro2(object, type) \
virtual void Set ## object (type * _arg) \
{ \
vtkSetObjectMacro2Body (object, type, _arg); \
} \
//ETX
class vtkMatrix4x4;
class vtkScalarBarActor;
class vtkLookupTable;
class vtkTextProperty;
class vtkCornerAnnotation;
class vtkOrientationAnnotation;
// class vtkQuadricLODActor;
class vtkActor;
class vtkDataSet;
class vtkPolyData;
class vtkProperty;
class vtkMatrixToLinearTransform;
class vtkRenderWindowInteractor;
class vtkInteractorStyle;
class vtkColorTransferFunction;
class vtkProp3D;
class vtkProp;
class vtkTransform;
class vtkScalarsToColors;
/**
* \defgroup MegaVTK MegaVTK
*/
/**
\class vtkViewImage
\ingroup MegaVTK
\brief This class is a top-level convenience class for displaying a
scalar - or RGB image in a 2D or 3D scene.
It inherits from the vtkImageViewer2 class, which is initially designed
for 2D scene visualization. However, vtkViewImage overrides some of its
parents' methods (SetSlice()) in order to generalize its purpose to 2D
AND 3D scene visualization.
As a high-level class, it provides the user with convinient
functionalities such as a colormap (SetLookupTable()), a scalar bar
(ScalarBarActor), some corner annotations (CornerAnnotation), access to
the background color (SetBackground()), the annotation text properties
(SetTextProperty()), or a call for reseting to default values (Reset() or
ResetCamera()).
The principle add-on of this class is to tacke the common issue of placing
different objects in a same consistent reference frame. In a world
coordinates system, an volume image can be localized by its origin and
its spacing, and an orientation vector defining how to rotate the volume
to be consistent with reality.
The vtkImageData class has among its attributes the origin and the
spacing information. However, the orientation information is missing.
The vtkViewImage class tackle this lack by providing the user the
possibility to set an orientation matrix with SetOrientationMatrix().
This matrix will directly be applied to the actor describing the image
in the 2D - or 3D - scene. The rotation 3x3 component of this matrix has
to be orthogonal (no scaling). The offset component may contain the
origin information.
In this case the user will have to make sure that this information is
absent from the vtkImageData instance given in SetInput(). For that you
can call : view->GetInput()->SetOrigin(0,0,0).
*/
class VTK_RENDERINGADDON2_EXPORT vtkViewImage:public vtkImageViewer2
{
public:
vtkTypeRevisionMacro(vtkViewImage, vtkImageViewer2);
virtual void SetInput(vtkImageData *input);
// Description:
// Render the resulting image.
virtual void Render(void);
/**
Access to the RenderWindow interactor
*/
virtual vtkRenderWindowInteractor * GetInteractor();
virtual vtkRenderWindowInteractor * GetRenderWindowInteractor();
/**
\brief Get the corner annotation.
\todo make the corner annotation such that it follows the slice number,
the image scalar value at cursor, the spacing, etc
*/
vtkGetObjectMacro(CornerAnnotation, vtkCornerAnnotation);
/**
\brief Get the scalar bar actor. This instance follows the color
window/level of the viewer.
*/
vtkGetObjectMacro(ScalarBarActor, vtkScalarBarActor);
/**
\brief The OrientationMatrix instance (GetOrientationMatrix()) is a
very important added feature of this viewer. It describes the rotation
and translation to apply to the image bouding box (axis aligned) to the
world coordinate system.
Rotation part is usually given by the GetDirection() method on an
itk::Image for instance. Translation usually correspond to the origin
of the image given by GetOrigin() on an itk::Image.
CAUTION: if you provide non-zero origin to the viewer vtkImageData input
(SetInput()), then don't provide translation to the OrientationMatrix
instance, otherwise the information is redundant.
The best behaviour is to force the origin of the vtkImageData input
to zero and provide this origin information in the OrientationMatrix.
*/
vtkGetObjectMacro(OrientationMatrix, vtkMatrix4x4);
virtual void SetOrientationMatrix(vtkMatrix4x4 *matrix);
/**
The LookupTable instance (GetLookupTable()) can be used to set a
user-defined color-table to the viewer. Default is a linear black to
white table.
*/
vtkGetObjectMacro(LookupTable, vtkLookupTable);
virtual void SetLookupTable(vtkLookupTable *lookuptable);
/**
* \brief Get a pointer to the current vtkTextProperty
*
* The TextProperty instance (GetTextProperty()) describes the font
* and other settings of the CornerAnnotation instance
* (GetCornerAnnotation())
*/
vtkGetObjectMacro(TextProperty, vtkTextProperty);
virtual void SetTextProperty(vtkTextProperty *textproperty);
/**
* \brief Set the world coordinates
* \param[in] x x value
* \param[in] y y value
* \param[in] z z value
*
* The world is not always what we think it is ...
* Use this method to move the viewer slice such that the position
* (in world coordinates) given by the arguments is contained by
* the slice plane. If the given position is outside the bounds
* of the image, then the slice will be as close as possible.
*/
void SetWorldCoordinates(const double & x,
const double & y, const double & z);
virtual void SetWorldCoordinates(double pos[3]) = 0;
/**
\brief Set/Get the current slice to display (depending on the orientation
this can be in X, Y or Z).
This method has been overriden in order to generalize the use of this class
to 2D AND 3D scene visualization. Thus in this top-level class SetSlice() does
not do anything.
\param[in] iSlice New position of the slice
*/
virtual void SetSlice(int iSlice)
{
int *range = this->GetSliceRange();
if (range)
{
if (iSlice < range[0])
{
iSlice = range[0];
}
else if (iSlice > range[1])
{
iSlice = range[1];
}
}
if (this->Slice == iSlice)
{
return;
}
this->Slice = iSlice;
this->Modified();
this->UpdateDisplayExtent();
}
virtual void Update(void){}
/**
\brief Convert an indices coordinate point (image coordinates) into a world
coordinate point
*/
virtual double *GetWorldCoordinatesFromImageCoordinates(int indices[3]);
/**
\brief Convert a world coordinate point into an image indices coordinate point
*/
virtual int *GetImageCoordinatesFromWorldCoordinates(double position[3]);
/**
\brief Get the pixel value at a given world coordinate point in space, return
zero if out of bounds.
*/
virtual double GetValueAtPosition(double worldcoordinates[3],
int component = 0);
/**
\brief Set the background color. Format is RGB, 0 <= R,G,B <=1
Example: SetBackground(0.9,0.9,0.9) for grey-white.
*/
virtual void SetBackground(double rgb[3]);
virtual void SetBackground(const double & r,
const double & g,
const double & b);
virtual double * GetBackground(void);
/**
\brief Reset the camera
*/
virtual void ResetCamera(void);
/**
* \brief Set the camera position
* \param[in] arg pointer to a double[3] containing the new position of the camera
*/
void SetCameraPosition(double *arg);
/**
* \brief Get the camera position
* \return pointer to a double[3] containing the position of the camera
*/
double * GetCameraPosition(void);
/**
* \brief Set the camera focal point
* \param[in] arg pointer to a double[3] containing the new focal point of the
* camera
*/
void SetCameraFocalPoint(double *arg);
/**
* \brief Get the camera focal point
* \return pointer to a double[3] containing the new focal point of the
* camera
*/
double * GetCameraFocalPoint(void);
/**
* \brief Set the camera view up
* \param[in] arg pointer to a double[3] containing the new view up of the
* camera
*/
void SetCameraViewUp(double *arg);
/**
* \brief Get the camera view up
* \return pointer to a double[3] containing the new view up of the
* camera
*/
double * GetCameraViewUp(void);
/**
* \brief Set the camera parallel scale
* \param[in] arg double containing the new parallel scale
*/
void SetCameraParallelScale(double arg);
/**
* \brief Get the camera parallel scale
* \return double containing the new parallel scale
*/
double GetCameraParallelScale(void);
/**
\brief Reset position - zoom - window/level to default
*/
virtual void Reset(void);
/**
* \brief Set the annotation status.
* 0: annotations are not visible
* 1: annotations are visible
*/
vtkBooleanMacro (ShowAnnotations, int);
/**
* \brief Get the annotation status.
* 0: annotations are not visible
* 1: annotations are visible
*/
vtkGetMacro (ShowAnnotations, int);
/**
* \brief Change the visibility of the annotations
* \param[in] iShowAnnotations int
* 0: annotations are not visible
* 1: annotations are visible
*/
virtual void SetShowAnnotations(const int & iShowAnnotations);
/**
\brief Enable or Disable interaction on the view.
*/
virtual void Enable(void);
/**
\brief Enable or Disable interaction on the view.
*/
virtual void Disable(void);
/**
\brief Enable or Disable interaction on the view.
*/
virtual bool GetEnabled(void);
/**
* \brief Set the visibility of the scalar bar.
* 0: scalar bar is not visible
* 1: scalar bar is visible
*/
vtkBooleanMacro(ShowScalarBar, int);
/**
* \brief Get the visibility of the scalar bar.
* 0: scalar bar is not visible
* 1: scalar bar is visible
*/
vtkGetMacro(ShowScalarBar, int);
/**
\brief Show/Hide scalar bar.
*/
virtual void SetShowScalarBar(const bool &);
/** \brief Set window and level for mapping pixels to colors. */
virtual void SetColorWindow(double s);
virtual void SetColorLevel(double s);
/**
\brief Reset the window level
*/
virtual void ResetWindowLevel(void);
void UpdateWindowLevel();
/**
* \brief Get the current position in world coordinate.
* \return double pointer to the current position in world coordinates
*
* This framework is only used in vtkViewImage2D to
* update corner annotations and cursor position.
*/
double * GetCurrentPoint(void)
{ return this->CurrentPoint; }
/**
* \brief Get the current position in world coordinate.
* \param[in,out] point double pointer to the current position in world coordinates (double[3])
*
* This framework is only used in vtkViewImage2D to
* update corner annotations and cursor position.
*/
void GetCurrentPoint(double point[3])
{
point[0] = this->CurrentPoint[0];
point[1] = this->CurrentPoint[1];
point[2] = this->CurrentPoint[2];
}
/**
* \brief Get information about the color of the image.
* true: multi-channels image (i.e. color)
* false: single-channel image (i.e. black and white)
*/
vtkGetMacro(IsColor, bool);
/** \brief Set the linewidth for added dataset in the scene (when using AddDataSet) */
vtkSetMacro( IntersectionLineWidth, float );
/** \brief Get the linewidth for added dataset in the scene (when using AddDataSet) */
vtkGetMacro( IntersectionLineWidth, float );
void SetWindow(double iWindow);
double GetWindow();
void SetLevel(double iLevel);
double GetLevel();
protected:
vtkViewImage();
~vtkViewImage();
/**
The OrientationMatrix instance (GetOrientationMatrix()) is a very important
added feature of this viewer. It describes the rotation and translation to
apply to the image bouding box (axis aligned) to the world coordinate system.
Rotation part is usually given by the GetDirection() method on an itk::Image
for instance. Translation usually correspond to the origin of the image given
by GetOrigin() on an itk::Image.
CAUTION: if you provide non-zero origin to the viewer vtkImageData input
(SetInput()), then don't provide translation to the OrientationMatrix instance,
otherwise the information is redundant.
The best behaviour is to force the origin of the vtkImageData input to zero and
provide this origin information in the OrientationMatrix.
*/
vtkMatrix4x4 *OrientationMatrix;
/**
The corner annotation gather information related to the image.
In vtkViewImage2D, it displays slice number, spacing, window-level, position, etc
Access and change the values with GetCornerAnnotation()->SetText(n, const char*).
n begins down-right and increases anti-clockwise.
*/
vtkCornerAnnotation *CornerAnnotation;
/**
The TextProperty instance (GetTextProperty()) describes the font and
other settings of the CornerAnnotation instance (GetCornerAnnotation())
*/
vtkTextProperty *TextProperty;
/**
The LookupTable instance (GetLookupTable()) can be used to set a user-defined
color-table to the viewer. Default is a linear black to white table.
*/
vtkLookupTable *LookupTable;
/**
Get the scalar bar actor. This instance follows the color window/level
of the viewer.
*/
vtkScalarBarActor *ScalarBarActor;
/**
This vtkTransform instance carries the OrientationMatrix (see GetOrientationMatrix())
and is used to quickly transform the slice plane in vtkViewImage2D.
*/
vtkMatrixToLinearTransform *OrientationTransform;
std::string DirectionAnnotationMatrix[3][2];
float IntersectionLineWidth;
/**
local instances.
*/
int ShowAnnotations;
int ShowScalarBar;
/**
Get the current position in world coordinate.
This framework is only used in vtkViewImage2D to
update corner annotations and cursor position.
*/
double CurrentPoint[3];
bool IsColor;
double Window;
double Level;
};
#endif /* _vtkViewImage_h_ */
|