#include "Blank_DefOrgViewerAdapter.h" extern "C" #ifdef _WIN32 __declspec( dllexport ) #endif //DO NOT MODIFY THIS mial::DefOrgViewerAdapterBase* defOrgLoad() { return new mial::Blank_DefOrgViewerAdapter(); } namespace mial{ Blank_DefOrgViewerAdapter::Blank_DefOrgViewerAdapter(){ /*Example //Expose a property called "Sigma" with selectable range 0 to 10. //The default value is 1, the resolution of the select scale is 0.1, and //a help message "Sigma for Gradient Sensor" AddOrganismProperty("Sigma",0,10,1.0,0.1,"Sigma for Gradient Sensor"); */ } int Blank_DefOrgViewerAdapter::MaxNumberOfOutputItkSpatialObjects(){ //Return the number of spatial object output this organism will have //In this case, 2 is returned, so the viewer will create 1 additional window //This first output will always be displayed in the primary window return 2; } int Blank_DefOrgViewerAdapter::MaxNumberOfOutputImages(){ //Return the number of spatial object output this organism will have //In this case, 2 is returned, so the viewer will create 1 additional window //This first output will always be displayed in the primary window return 2; } void Blank_DefOrgViewerAdapter::HandleUserMouseInteraction(vtkTransform* userTransformation){ //To Do: Based on the userTransformation, update the internal data structure of the organism //The following example merely prints the transformation to acknowledge the organism //recieved the input. userTransformation->Print(std::cout); } void Blank_DefOrgViewerAdapter::PopulateItkScene(){ /* This method is called ONCE only when the user select a mesh from Load Mesh button. When new information needs to be displayed in the viewer, the isModified field of the corresponding output must be set to true*/ itkScenePointer itkScene = m_OutputItkSpatialObjects[0].theItkScene; m_OutputItkSpatialObjects[0].isModified=true; itkScenePointer itkScene2 = m_OutputItkSpatialObjects[1].theItkScene; m_OutputItkSpatialObjects[1].isModified=true; //geomLayerPointer->readTopologyFromFile( m_MeshFileName ); /*The spatial objects to be displayed should be added to the itkScene(s) supplied by the viewer. The number of itkScene supplied depends on MaxNumberOfOutputItkSpatialObjects()*/ //To Do: Replace 0 with correct output itkScene->AddSpatialObject( 0 /*geomLayerPointer->theMeshSpatialObject*/); itkScene2->AddSpatialObject( 0 /*geomLayerPointer->theMeshSpatialObject*/); } void Blank_DefOrgViewerAdapter::PopulateVtkImage(){ /* This method is called ONCE only when the user select a mesh from Load Image button. When new information needs to be displayed in the viewer, the isModified field of the corresponding output must be set to true*/ vtkImageImport* vtkImporter = m_OutputImages[0].theImageVolume; m_OutputImages[0].isModified=true; vtkImageImport* vtkImporter2 = m_OutputImages[1].theImageVolume; m_OutputImages[1].isModified=true; /*m_InputImageReader = ImageFileReader::New(); m_InputImageReader->SetFileName(m_ImageFileName.c_str()); m_InputImageReader->Update(); ImageType::Pointer image = m_InputImageReader->GetOutput(); */ /*The image to be displayed should be connected to the vtkImporter(s) supplied by the viewer. The number of vtkImporter supplied depends on MaxNumberOfOutputImages()*/ //To Do: Replace 0 with correct output PopulateVtkImageHelper(0/*image*/, vtkImporter); PopulateVtkImageHelper(0/*image*/, vtkImporter2); } void Blank_DefOrgViewerAdapter::UpdateOrganism(){ itkScenePointer itkScene = m_OutputItkSpatialObjects[0].theItkScene; //isModified field needs to be set to true in order for the viewer to pick up the change m_OutputItkSpatialObjects[0].isModified=true; //To Do: Execute the organism //testOrg->run(); //Note that Modified() should be called on the mesh object as well //geomLayerPointer->theMeshSpatialObject->Modified(); } void Blank_DefOrgViewerAdapter::SetupOrganism() { //Setup the organism } void Blank_DefOrgViewerAdapter::PopulateVtkUnstructuredGrid(vtkUnstructuredGrid* vtkGrid /*in/out*/){ //This method is currently not used //geomLayerPointer->readTopologyFromFile( m_MeshFileName ); //MeshToUnstructuredGrid( geomLayerPointer->theMesh, vtkGrid/*in/out*/ ); } }