C:/cmcintos/defOrgs/examples/DefOrgViewerWithKW/Source/DefOrgAdapter/BlankDefOrgAdapter/Blank_DefOrgViewerAdapter.cxx

00001 #include "Blank_DefOrgViewerAdapter.h"
00002 
00003 extern "C" 
00004 #ifdef _WIN32
00005 __declspec( dllexport ) 
00006 #endif  
00007 //DO NOT MODIFY THIS
00008 mial::DefOrgViewerAdapterBase* defOrgLoad()
00009 {
00010         return new mial::Blank_DefOrgViewerAdapter();
00011 }
00012 
00013 
00014 namespace mial{
00015 Blank_DefOrgViewerAdapter::Blank_DefOrgViewerAdapter(){
00016         /*Example
00017         //Expose a property called "Sigma" with selectable range 0 to 10.  
00018         //The default value is 1, the resolution of the select scale is 0.1, and
00019         //a help message "Sigma for Gradient Sensor"
00020         AddOrganismProperty("Sigma",0,10,1.0,0.1,"Sigma for Gradient Sensor");  
00021         */      
00022 }
00023 
00024 
00025 int Blank_DefOrgViewerAdapter::MaxNumberOfOutputItkSpatialObjects(){
00026         //Return the number of spatial object output this organism will have
00027         //In this case, 2 is returned, so the viewer will create 1 additional window 
00028         //This first output will always be displayed in the primary window
00029         return 2;
00030 }
00031 
00032 
00033 int Blank_DefOrgViewerAdapter::MaxNumberOfOutputImages(){
00034         //Return the number of spatial object output this organism will have
00035         //In this case, 2 is returned, so the viewer will create 1 additional window 
00036         //This first output will always be displayed in the primary window
00037         return 2;
00038 }
00039 
00040 void Blank_DefOrgViewerAdapter::HandleUserMouseInteraction(vtkTransform* userTransformation){
00041         //To Do: Based on the userTransformation, update the internal data structure of the organism
00042         //The following example merely prints the transformation to acknowledge the organism
00043         //recieved the input.
00044         userTransformation->Print(std::cout);
00045 }
00046 
00047 void Blank_DefOrgViewerAdapter::PopulateItkScene(){
00048         /*
00049         This method is called ONCE only when the user select a mesh from Load Mesh button.
00050 
00051         When new information needs to be displayed in the viewer, the isModified
00052         field of the corresponding output must be set to true*/
00053         itkScenePointer itkScene = m_OutputItkSpatialObjects[0].theItkScene;
00054         m_OutputItkSpatialObjects[0].isModified=true;
00055         itkScenePointer itkScene2 = m_OutputItkSpatialObjects[1].theItkScene;
00056         m_OutputItkSpatialObjects[1].isModified=true;
00057         //geomLayerPointer->readTopologyFromFile( m_MeshFileName );
00058 
00059         /*The spatial objects to be displayed should be added to the itkScene(s) supplied
00060         by the viewer.  The number of itkScene supplied depends on MaxNumberOfOutputItkSpatialObjects()*/
00061 
00062         //To Do: Replace 0 with correct output
00063         itkScene->AddSpatialObject( 0  /*geomLayerPointer->theMeshSpatialObject*/);  
00064         itkScene2->AddSpatialObject( 0 /*geomLayerPointer->theMeshSpatialObject*/);  
00065 }
00066 
00067 void Blank_DefOrgViewerAdapter::PopulateVtkImage(){
00068         /*
00069         This method is called ONCE only when the user select a mesh from Load Image button.
00070 
00071         When new information needs to be displayed in the viewer, the isModified
00072         field of the corresponding output must be set to true*/
00073         vtkImageImport* vtkImporter = m_OutputImages[0].theImageVolume;
00074         m_OutputImages[0].isModified=true;
00075         vtkImageImport* vtkImporter2 = m_OutputImages[1].theImageVolume;
00076         m_OutputImages[1].isModified=true;
00077         /*m_InputImageReader = ImageFileReader::New();
00078         m_InputImageReader->SetFileName(m_ImageFileName.c_str());
00079         
00080         m_InputImageReader->Update();
00081         ImageType::Pointer image = m_InputImageReader->GetOutput();     */
00082 
00083         /*The image to be displayed should be connected to the vtkImporter(s) supplied
00084         by the viewer.  
00085         The number of vtkImporter supplied depends on MaxNumberOfOutputImages()*/
00086 
00087         //To Do: Replace 0 with correct output
00088 
00089         PopulateVtkImageHelper(0/*image*/, vtkImporter);
00090         PopulateVtkImageHelper(0/*image*/, vtkImporter2);
00091 }
00092 
00093 
00094 void Blank_DefOrgViewerAdapter::UpdateOrganism(){
00095         itkScenePointer itkScene = m_OutputItkSpatialObjects[0].theItkScene;
00096         //isModified field needs to be set to true in order for the viewer to pick up the change
00097         m_OutputItkSpatialObjects[0].isModified=true;
00098         //To Do: Execute the organism
00099         //testOrg->run();
00100         //Note that Modified() should be called on the mesh object as well
00101         //geomLayerPointer->theMeshSpatialObject->Modified();
00102 }
00103 
00104 
00105 void Blank_DefOrgViewerAdapter::SetupOrganism()
00106 {
00107         //Setup the organism
00108 }
00109 
00110 
00111 void Blank_DefOrgViewerAdapter::PopulateVtkUnstructuredGrid(vtkUnstructuredGrid* vtkGrid /*in/out*/){
00112         //This method is currently not used
00113         //geomLayerPointer->readTopologyFromFile( m_MeshFileName );
00114         //MeshToUnstructuredGrid( geomLayerPointer->theMesh, vtkGrid/*in/out*/ );
00115 }
00116 }

Generated on Wed Jul 19 13:05:15 2006 for IDO by  doxygen 1.4.7