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
|
/*=========================================================================
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkVVDataItem - an abstract class that encapsulates a single piece of data
// .SECTION Description
// This is an abstract single piece of data, that is likely to be subclassed
// into a single volume (or a set of slices), or single polydata. Multiple
// vtkVVDataItem are usually stored in a vtkVVDataItemPool (an
// instance of that pool can be found in vtkVVWindowBase).
#ifndef __vtkVVDataItem_h
#define __vtkVVDataItem_h
#include "vtkKWObject.h"
#include "XML/vtkXMLIOBaseMacros.h" // Needed for XML reader/writer macros
class vtkVVDataItemInternals;
class vtkVVWindowBase;
class vtkVVFileInstance;
class VTK_EXPORT vtkVVDataItem : public vtkKWObject
{
public:
vtkTypeRevisionMacro(vtkVVDataItem,vtkKWObject);
virtual void PrintSelf(ostream& os, vtkIndent indent);
//BTX
vtkKWGetXMLReaderWriterObjectsMacro();
//ETX
// Description:
// Set/Get the name of the data item.
// As a rule of thumb, the data name should be unique enough that it can
// be used efficiently to find the data inside a vtkVVDataItemPool.
// The filename to the data itself is a reasonable choice.
// NOTE: this should be fixed, as a single file may lead to several data items
// (retrieved from different Algorithm's ports for example, so one could
// append the port number to the file name).
vtkSetStringMacro(Name);
vtkGetStringMacro(Name);
// Description:
// Set/Get the descriptive name of the data item.
// The descriptive name is used to provide a reasonable but short clue to
// the user about the data. Since the data 'Name' is usually the filename
// to the data, subclasses are suggested to set the descriptive name
// to something more meaningful, say the name of the patient if the data
// item is a medical data.
// If not set when GetDescriptiveName is called, it is set automatically
// from the value of 'Name' by considering it a filename and removing
// both the path and the extension.
virtual const char *GetDescriptiveName();
vtkSetStringMacro(DescriptiveName);
// Description:
// Set/Get the physical units for this dataset (e.g. mm, cm, inches)
vtkSetStringMacro(DistanceUnits);
vtkGetStringMacro(DistanceUnits);
// Description:
// Set/Get the scope of this data
// Better match vtkKWOpenFileProperties::Scope. Though we do have a pointer
// to a file instance, which may have a pointer to a open file properties,
// some data item may be created programmatically without any file to
// refer to.
//BTX
enum
{
ScopeUnknown = 0,
ScopeMedical,
ScopeScientific
};
//ETX
vtkGetMacro(Scope, int);
virtual void SetScope(int);
virtual void SetScopeToUnknown();
virtual void SetScopeToMedical();
virtual void SetScopeToScientific();
// Description:
// Get the bounds of the data
virtual void GetBounds(double bounds[6]) = 0;
// Description:
// Release data. Each subclass will implement specific methods to
// set and allocate the proper data (say, image data/volume), but
// this method should be implemented to release the data properly.
virtual void ReleaseData() {};
// Description:
// Add/Remove default widgets to a window
// For image/volume data, this will create the default 3D view, 2D views,
// lightbox, etc.
virtual void AddDefaultRenderWidgets(vtkVVWindowBase *) {};
virtual void RemoveDefaultRenderWidgets(vtkVVWindowBase *) {};
// Description:
// Get number of renderwidgets (including all windows)
virtual int GetNumberOfRenderWidgets() { return 0; };
// Description:
// Query if the data item has a representation (say a 2D or 3D view) in
// a given window.
virtual int HasRenderWidgetInWindow(vtkVVWindowBase *) { return 0; };
// Description:
// Update the default widgets annotations, if any
virtual void UpdateRenderWidgetsAnnotations() {};
// Description:
// Set/Get the pointer to the file instance that data item may have been
// loaded from (not all data items are created from files though).
// Note that the FileInstance itself may store pointers to all the data items
// that were created by loading it (see vtkVVFileInstance::DataItemPool).
vtkGetObjectMacro(FileInstance, vtkVVFileInstance);
virtual void SetFileInstance(vtkVVFileInstance *instance);
protected:
vtkVVDataItem();
~vtkVVDataItem();
// Description:
// Data item name
char *Name;
// Description:
// Data item descriptive name
char *DescriptiveName;
// Description:
// PIMPL Encapsulation for STL containers
//BTX
vtkVVDataItemInternals *Internals;
//ETX
// Description:
// Distance units
char *DistanceUnits;
// Description:
// Scope
int Scope;
// Description:
// Pointer to the file instance that data item may have been
// loaded from (not all data items are created from files though).
vtkVVFileInstance *FileInstance;
private:
vtkVVDataItem(const vtkVVDataItem&); // Not implemented
void operator=(const vtkVVDataItem&); // Not implemented
};
#endif
|