diff --git a/Beams/Logic/CMakeLists.txt b/Beams/Logic/CMakeLists.txt index 47d6fecfa..c554f413f 100644 --- a/Beams/Logic/CMakeLists.txt +++ b/Beams/Logic/CMakeLists.txt @@ -8,18 +8,19 @@ set(${KIT}_INCLUDE_DIRECTORIES ${SlicerRtCommon_INCLUDE_DIRS} ${vtkSlicerBeamsModuleMRML_INCLUDE_DIRS} ${vtkSlicerSubjectHierarchyModuleLogic_INCLUDE_DIRS} + ${vtkIECTransformLogic_INCLUDE_DIRS} ) set(${KIT}_SRCS vtkSlicer${MODULE_NAME}ModuleLogic.cxx vtkSlicer${MODULE_NAME}ModuleLogic.h - vtkSlicerIECTransformLogic.cxx - vtkSlicerIECTransformLogic.h vtkSlicerMLCPositionLogic.cxx vtkSlicerMLCPositionLogic.h ) -SET (${KIT}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${vtkSlicerBeamsModuleMRML_INCLUDE_DIRS} CACHE INTERNAL "" FORCE) +SET (${KIT}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${vtkSlicerBeamsModuleMRML_INCLUDE_DIRS} ${vtkIECTransformLogic_INCLUDE_DIRS} CACHE INTERNAL "" FORCE) + +find_package(vtkIECTransformLogic REQUIRED) set(${KIT}_TARGET_LIBRARIES vtkSlicer${MODULE_NAME}ModuleMRML @@ -28,8 +29,10 @@ set(${KIT}_TARGET_LIBRARIES vtkSlicerSubjectHierarchyModuleLogic ${ITK_LIBRARIES} ${VTK_LIBRARIES} + vtkIECTransformLogic ) + #----------------------------------------------------------------------------- SlicerMacroBuildModuleLogic( NAME ${KIT} @@ -38,4 +41,4 @@ SlicerMacroBuildModuleLogic( SRCS ${${KIT}_SRCS} TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES} ) - + diff --git a/Beams/Logic/vtkSlicerBeamsModuleLogic.cxx b/Beams/Logic/vtkSlicerBeamsModuleLogic.cxx index ae5a1d897..d778acde0 100644 --- a/Beams/Logic/vtkSlicerBeamsModuleLogic.cxx +++ b/Beams/Logic/vtkSlicerBeamsModuleLogic.cxx @@ -20,7 +20,6 @@ // Beams includes #include "vtkSlicerBeamsModuleLogic.h" -#include "vtkSlicerIECTransformLogic.h" #include "vtkSlicerMLCPositionLogic.h" // SlicerRT includes @@ -46,7 +45,7 @@ vtkStandardNewMacro(vtkSlicerBeamsModuleLogic); //---------------------------------------------------------------------------- vtkSlicerBeamsModuleLogic::vtkSlicerBeamsModuleLogic() : MLCPositionLogic(vtkSlicerMLCPositionLogic::New()) - , IECLogic(vtkSlicerIECTransformLogic::New()) + , IECLogic(vtkIECTransformLogic::New()) { } @@ -172,7 +171,7 @@ void vtkSlicerBeamsModuleLogic::OnMRMLSceneEndImport() } //--------------------------------------------------------------------------- -void vtkSlicerBeamsModuleLogic::SetIECLogic(vtkSlicerIECTransformLogic* iecLogic) +void vtkSlicerBeamsModuleLogic::SetIECLogic(vtkIECTransformLogic* iecLogic) { if (iecLogic == nullptr) { @@ -183,7 +182,7 @@ void vtkSlicerBeamsModuleLogic::SetIECLogic(vtkSlicerIECTransformLogic* iecLogic this->IECLogic->Delete(); this->IECLogic = nullptr; - vtkSetObjectBodyMacro(IECLogic, vtkSlicerIECTransformLogic, iecLogic); + vtkSetObjectBodyMacro(IECLogic, vtkIECTransformLogic, iecLogic); } //---------------------------------------------------------------------------- @@ -361,7 +360,7 @@ void vtkSlicerBeamsModuleLogic::UpdateBeamTransform(vtkMRMLRTBeamNode* beamNode, this->UpdateIECTransformsFromBeam(beamNode, isocenter); vtkNew beamGeneralTransform; - this->IECLogic->GetTransformBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::RAS, beamGeneralTransform, true); + this->IECLogic->GetTransformBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::RAS, beamGeneralTransform, true); // Convert general transform to linear // This call also makes hard copy of the transform so that it doesn't change when other beam transforms change @@ -406,7 +405,7 @@ void vtkSlicerBeamsModuleLogic::UpdateIECTransformsFromBeam(vtkMRMLRTBeamNode* b //----------------------------------------------------------------------------- void vtkSlicerBeamsModuleLogic::UpdateRASRelatedTransforms( - vtkSlicerIECTransformLogic* iecLogic/*=nullptr*/, vtkMRMLRTPlanNode* planNode/*=nullptr*/, double* isocenter/*=nullptr*/, bool transformForBeam/*=false*/) + vtkIECTransformLogic* iecLogic/*=nullptr*/, vtkMRMLRTPlanNode* planNode/*=nullptr*/, double* isocenter/*=nullptr*/, bool transformForBeam/*=false*/) { if (!this->GetMRMLScene()) { @@ -422,7 +421,7 @@ void vtkSlicerBeamsModuleLogic::UpdateRASRelatedTransforms( // Do the same for the RAS to Patient transform as well. vtkNew fixedReferenceToRASTransformBeamComponent; vtkTransform* rasToPatientReferenceTransform = iecLogic->GetElementaryTransformBetween( - vtkSlicerIECTransformLogic::RAS, vtkSlicerIECTransformLogic::Patient); + vtkIECTransformLogic::RAS, vtkIECTransformLogic::Patient); if (rasToPatientReferenceTransform == nullptr) { vtkErrorMacro("UpdateRASRelatedTransforms: Failed to find RAS related transforms in the IEC logic"); @@ -477,7 +476,7 @@ void vtkSlicerBeamsModuleLogic::UpdateRASRelatedTransforms( // Set up concatenation for final fixed reference to RAS transform vtkNew tableTopToTableTopEccentricRotationGeneralTransform; iecLogic->GetTransformBetween( - vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation, tableTopToTableTopEccentricRotationGeneralTransform, transformForBeam); + vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation, tableTopToTableTopEccentricRotationGeneralTransform, transformForBeam); vtkNew tableTopToTableTopEccentricRotationLinearTransform; if (!vtkMRMLTransformNode::IsGeneralTransformLinear(tableTopToTableTopEccentricRotationGeneralTransform, tableTopToTableTopEccentricRotationLinearTransform)) { @@ -487,7 +486,7 @@ void vtkSlicerBeamsModuleLogic::UpdateRASRelatedTransforms( vtkNew patientSupportRotationToFixedReferenceGeneralTransform; iecLogic->GetTransformBetween( - vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference, patientSupportRotationToFixedReferenceGeneralTransform, transformForBeam); + vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference, patientSupportRotationToFixedReferenceGeneralTransform, transformForBeam); vtkNew patientSupportRotationToFixedReferenceLinearTransform; if (!vtkMRMLTransformNode::IsGeneralTransformLinear(patientSupportRotationToFixedReferenceGeneralTransform, patientSupportRotationToFixedReferenceLinearTransform)) { @@ -504,6 +503,6 @@ void vtkSlicerBeamsModuleLogic::UpdateRASRelatedTransforms( // Update fixed reference to RAS transform in IEC logic vtkTransform* fixedReferenceToRASTransform = iecLogic->GetElementaryTransformBetween( - vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS); + vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS); fixedReferenceToRASTransform->DeepCopy(fixedReferenceToRASTransformNew); } diff --git a/Beams/Logic/vtkSlicerBeamsModuleLogic.h b/Beams/Logic/vtkSlicerBeamsModuleLogic.h index f7f11c45f..1c888fcb9 100644 --- a/Beams/Logic/vtkSlicerBeamsModuleLogic.h +++ b/Beams/Logic/vtkSlicerBeamsModuleLogic.h @@ -30,10 +30,12 @@ // Slicer includes #include "vtkSlicerModuleLogic.h" +// IEC Logic include +#include + // Beams includes #include "vtkSlicerBeamsModuleLogicExport.h" #include "vtkMRMLRTBeamNode.h" -#include "vtkSlicerIECTransformLogic.h" // VTK includes #include @@ -77,14 +79,14 @@ class VTK_SLICER_BEAMS_LOGIC_EXPORT vtkSlicerBeamsModuleLogic : public vtkSlicer /// \param planNode: Plan node to get the isocenter position from /// \param isocenter: Option to set any isocenter for dynamic beams /// \param transformForBeam: calculate dynamic transformation for beam model or other models. False by default. - void UpdateRASRelatedTransforms(vtkSlicerIECTransformLogic* iecLogic=nullptr, vtkMRMLRTPlanNode* planNode=nullptr, double* isocenter=nullptr, bool transformForBeam=false); + void UpdateRASRelatedTransforms(vtkIECTransformLogic* iecLogic=nullptr, vtkMRMLRTPlanNode* planNode=nullptr, double* isocenter=nullptr, bool transformForBeam=false); public: vtkGetObjectMacro(MLCPositionLogic, vtkSlicerMLCPositionLogic); - vtkGetObjectMacro(IECLogic, vtkSlicerIECTransformLogic); + vtkGetObjectMacro(IECLogic, vtkIECTransformLogic); /// Possibility to use an external IEC logic. This is useful for testing. - void SetIECLogic(vtkSlicerIECTransformLogic* iecLogic); + void SetIECLogic(vtkIECTransformLogic* iecLogic); protected: vtkSlicerBeamsModuleLogic(); @@ -108,7 +110,7 @@ class VTK_SLICER_BEAMS_LOGIC_EXPORT vtkSlicerBeamsModuleLogic : public vtkSlicer vtkSlicerMLCPositionLogic* MLCPositionLogic; private: - vtkSlicerIECTransformLogic* IECLogic; + vtkIECTransformLogic* IECLogic; }; #endif diff --git a/Beams/Logic/vtkSlicerIECTransformLogic.cxx b/Beams/Logic/vtkSlicerIECTransformLogic.cxx deleted file mode 100644 index b4a61a717..000000000 --- a/Beams/Logic/vtkSlicerIECTransformLogic.cxx +++ /dev/null @@ -1,383 +0,0 @@ -/*============================================================================== - - Copyright (c) Laboratory for Percutaneous Surgery (PerkLab) - Queen's University, Kingston, ON, Canada. All Rights Reserved. - - See COPYRIGHT.txt - or http://www.slicer.org/copyright/copyright.txt for details. - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - This file was originally developed by Vinith Suriyakumar and Csaba Pinter, - PerkLab, Queen's University and was supported through the Applied Cancer - Research Unit program of Cancer Care Ontario with funds provided by the - Ontario Ministry of Health and Long-Term Care - -==============================================================================*/ - -// Beams includes -#include "vtkSlicerIECTransformLogic.h" - -// VTK includes -#include -#include -#include -#include - -// STD includes -#include -#include - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(vtkSlicerIECTransformLogic); - -//----------------------------------------------------------------------------- -vtkSlicerIECTransformLogic::vtkSlicerIECTransformLogic() -{ - // Setup coordinate system ID to name map - this->CoordinateSystemsMap.clear(); - this->CoordinateSystemsMap[RAS] = "Ras"; - this->CoordinateSystemsMap[FixedReference] = "FixedReference"; - this->CoordinateSystemsMap[Gantry] = "Gantry"; - this->CoordinateSystemsMap[Collimator] = "Collimator"; - this->CoordinateSystemsMap[LeftImagingPanel] = "LeftImagingPanel"; - this->CoordinateSystemsMap[RightImagingPanel] = "RightImagingPanel"; - this->CoordinateSystemsMap[PatientSupportRotation] = "PatientSupportRotation"; - this->CoordinateSystemsMap[PatientSupport] = "PatientSupport"; - this->CoordinateSystemsMap[TableTopEccentricRotation] = "TableTopEccentricRotation"; - this->CoordinateSystemsMap[TableTop] = "TableTop"; - this->CoordinateSystemsMap[FlatPanel] = "FlatPanel"; - this->CoordinateSystemsMap[WedgeFilter] = "WedgeFilter"; - this->CoordinateSystemsMap[Patient] = "Patient"; - - this->IECTransforms.clear(); - this->IECTransforms.push_back(std::make_pair(FixedReference, RAS)); - this->IECTransforms.push_back(std::make_pair(Gantry, FixedReference)); - this->IECTransforms.push_back(std::make_pair(Collimator, Gantry)); - this->IECTransforms.push_back(std::make_pair(WedgeFilter, Collimator)); - this->IECTransforms.push_back(std::make_pair(LeftImagingPanel, Gantry)); - this->IECTransforms.push_back(std::make_pair(RightImagingPanel, Gantry)); - this->IECTransforms.push_back(std::make_pair(PatientSupportRotation, FixedReference)); // Rotation component of patient support transform - this->IECTransforms.push_back(std::make_pair(PatientSupport, PatientSupportRotation)); // Scaling component of patient support transform - this->IECTransforms.push_back(std::make_pair(TableTopEccentricRotation, PatientSupportRotation)); // NOTE: Currently not supported by REV - this->IECTransforms.push_back(std::make_pair(TableTop, TableTopEccentricRotation)); - this->IECTransforms.push_back(std::make_pair(Patient, TableTop)); - this->IECTransforms.push_back(std::make_pair(RAS, Patient)); - this->IECTransforms.push_back(std::make_pair(FlatPanel, Gantry)); - - // Set names for elementary transforms for discovery - this->FixedReferenceToRasTransform->SetObjectName(this->GetTransformNameBetween(FixedReference, RAS).c_str()); - this->GantryToFixedReferenceTransform->SetObjectName(this->GetTransformNameBetween(Gantry, FixedReference).c_str()); - this->CollimatorToGantryTransform->SetObjectName(this->GetTransformNameBetween(Collimator, Gantry).c_str()); - this->WedgeFilterToCollimatorTransform->SetObjectName(this->GetTransformNameBetween(WedgeFilter, Collimator).c_str()); - this->LeftImagingPanelToGantryTransform->SetObjectName(this->GetTransformNameBetween(LeftImagingPanel, Gantry).c_str()); - this->RightImagingPanelToGantryTransform->SetObjectName(this->GetTransformNameBetween(RightImagingPanel, Gantry).c_str()); - this->PatientSupportRotationToFixedReferenceTransform->SetObjectName(this->GetTransformNameBetween(PatientSupportRotation, FixedReference).c_str()); - this->PatientSupportToPatientSupportRotationTransform->SetObjectName(this->GetTransformNameBetween(PatientSupport, PatientSupportRotation).c_str()); - this->TableTopEccentricRotationToPatientSupportRotationTransform->SetObjectName(this->GetTransformNameBetween(TableTopEccentricRotation, PatientSupportRotation).c_str()); - this->TableTopToTableTopEccentricRotationTransform->SetObjectName(this->GetTransformNameBetween(TableTop, TableTopEccentricRotation).c_str()); - this->PatientToTableTopTransform->SetObjectName(this->GetTransformNameBetween(Patient, TableTop).c_str()); - this->RasToPatientTransform->SetObjectName(this->GetTransformNameBetween(RAS, Patient).c_str()); - this->FlatPanelToGantryTransform->SetObjectName(this->GetTransformNameBetween(FlatPanel, Gantry).c_str()); - - // Build list of elementary transforms for discovery by name - this->ElementaryTransforms.push_back(this->FixedReferenceToRasTransform); - this->ElementaryTransforms.push_back(this->GantryToFixedReferenceTransform); - this->ElementaryTransforms.push_back(this->CollimatorToGantryTransform); - this->ElementaryTransforms.push_back(this->WedgeFilterToCollimatorTransform); - this->ElementaryTransforms.push_back(this->LeftImagingPanelToGantryTransform); - this->ElementaryTransforms.push_back(this->RightImagingPanelToGantryTransform); - this->ElementaryTransforms.push_back(this->PatientSupportRotationToFixedReferenceTransform); - this->ElementaryTransforms.push_back(this->PatientSupportToPatientSupportRotationTransform); - this->ElementaryTransforms.push_back(this->TableTopEccentricRotationToPatientSupportRotationTransform); - this->ElementaryTransforms.push_back(this->TableTopToTableTopEccentricRotationTransform); - this->ElementaryTransforms.push_back(this->PatientToTableTopTransform); - this->ElementaryTransforms.push_back(this->RasToPatientTransform); - this->ElementaryTransforms.push_back(this->FlatPanelToGantryTransform); - - // Define the transform hierarchy - this->CoordinateSystemsHierarchy.clear(); - // key - parent, value - children - this->CoordinateSystemsHierarchy[FixedReference] = { Gantry, PatientSupportRotation }; - this->CoordinateSystemsHierarchy[Gantry] = { Collimator, LeftImagingPanel, RightImagingPanel, FlatPanel }; - this->CoordinateSystemsHierarchy[Collimator] = { WedgeFilter }; - this->CoordinateSystemsHierarchy[PatientSupportRotation] = { PatientSupport, TableTopEccentricRotation }; - this->CoordinateSystemsHierarchy[TableTopEccentricRotation] = { TableTop }; - this->CoordinateSystemsHierarchy[TableTop] = { Patient }; - this->CoordinateSystemsHierarchy[Patient] = { RAS }; - - // - // Build concatenated transform hierarchy - // - this->GantryToFixedReferenceConcatenatedTransform->Concatenate(this->FixedReferenceToRasTransform); - this->GantryToFixedReferenceConcatenatedTransform->Concatenate(this->GantryToFixedReferenceTransform); - - this->CollimatorToGantryConcatenatedTransform->Concatenate(this->GantryToFixedReferenceConcatenatedTransform); - this->CollimatorToGantryConcatenatedTransform->Concatenate(this->CollimatorToGantryTransform); - - this->WedgeFilterToCollimatorConcatenatedTransform->Concatenate(this->CollimatorToGantryConcatenatedTransform); - this->WedgeFilterToCollimatorConcatenatedTransform->Concatenate(this->WedgeFilterToCollimatorTransform); - - this->LeftImagingPanelToGantryConcatenatedTransform->Concatenate(this->CollimatorToGantryConcatenatedTransform); - this->LeftImagingPanelToGantryConcatenatedTransform->Concatenate(this->LeftImagingPanelToGantryTransform); - - this->RightImagingPanelToGantryConcatenatedTransform->Concatenate(this->CollimatorToGantryConcatenatedTransform); - this->RightImagingPanelToGantryConcatenatedTransform->Concatenate(this->RightImagingPanelToGantryTransform); - - this->FlatPanelToGantryConcatenatedTransform->Concatenate(this->CollimatorToGantryConcatenatedTransform); - this->FlatPanelToGantryConcatenatedTransform->Concatenate(this->FlatPanelToGantryTransform); - - this->PatientSupportRotationToFixedReferenceConcatenatedTransform->Concatenate(this->FixedReferenceToRasTransform); - this->PatientSupportRotationToFixedReferenceConcatenatedTransform->Concatenate(this->PatientSupportRotationToFixedReferenceTransform); - - this->PatientSupportToPatientSupportRotationConcatenatedTransform->Concatenate(this->PatientSupportRotationToFixedReferenceConcatenatedTransform); - this->PatientSupportToPatientSupportRotationConcatenatedTransform->Concatenate(this->PatientSupportToPatientSupportRotationTransform); - - this->TableTopEccentricRotationToPatientSupportRotationConcatenatedTransform->Concatenate(this->PatientSupportRotationToFixedReferenceConcatenatedTransform); - this->TableTopEccentricRotationToPatientSupportRotationConcatenatedTransform->Concatenate(this->TableTopEccentricRotationToPatientSupportRotationTransform); - - this->TableTopToTableEccentricRotationConcatenatedTransform->Concatenate(this->TableTopEccentricRotationToPatientSupportRotationConcatenatedTransform); - this->TableTopToTableEccentricRotationConcatenatedTransform->Concatenate(this->TableTopToTableTopEccentricRotationTransform); - - this->PatientToTableTopConcatenatedTransform->Concatenate(this->TableTopToTableEccentricRotationConcatenatedTransform); - this->PatientToTableTopConcatenatedTransform->Concatenate(this->PatientToTableTopTransform); - - this->RasToPatientConcatenatedTransform->Concatenate(this->PatientToTableTopConcatenatedTransform); - this->RasToPatientConcatenatedTransform->Concatenate(this->RasToPatientTransform); -} - -//----------------------------------------------------------------------------- -vtkSlicerIECTransformLogic::~vtkSlicerIECTransformLogic() -{ - this->CoordinateSystemsMap.clear(); - this->IECTransforms.clear(); - this->ElementaryTransforms.clear(); -} - -//---------------------------------------------------------------------------- -void vtkSlicerIECTransformLogic::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os, indent); - - os << indent << std::endl << "Elementary tansforms:" << std::endl; - - os << indent.GetNextIndent() << "FixedReferenceToRasTransform:" << std::endl; - this->FixedReferenceToRasTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "GantryToFixedReferenceTransform:" << std::endl; - this->GantryToFixedReferenceTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "CollimatorToGantryTransform:" << std::endl; - this->CollimatorToGantryTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "WedgeFilterToCollimatorTransform:" << std::endl; - this->WedgeFilterToCollimatorTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "LeftImagingPanelToGantryTransform:" << std::endl; - this->LeftImagingPanelToGantryTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "RightImagingPanelToGantryTransform:" << std::endl; - this->RightImagingPanelToGantryTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "FlatPanelToGantryTransform:" << std::endl; - this->FlatPanelToGantryTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "PatientSupportRotationToFixedReferenceTransform:" << std::endl; - this->PatientSupportRotationToFixedReferenceTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "PatientSupportToPatientSupportRotationTransform:" << std::endl; - this->PatientSupportToPatientSupportRotationTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "TableTopEccentricRotationToPatientSupportRotationTransform:" << std::endl; - this->TableTopEccentricRotationToPatientSupportRotationTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "TableTopToTableTopEccentricRotationTransform:" << std::endl; - this->TableTopToTableTopEccentricRotationTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "PatientToTableTopTransform:" << std::endl; - this->PatientToTableTopTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); - os << indent.GetNextIndent() << "RasToPatientTransform:" << std::endl; - this->RasToPatientTransform->GetMatrix()->PrintSelf(os, indent.GetNextIndent().GetNextIndent()); -} - -//---------------------------------------------------------------------------- -void vtkSlicerIECTransformLogic::UpdateGantryToFixedReferenceTransform(double gantryRotationAngleDeg) -{ - this->GantryToFixedReferenceTransform->Identity(); - this->GantryToFixedReferenceTransform->RotateY(gantryRotationAngleDeg); -} - -//---------------------------------------------------------------------------- -void vtkSlicerIECTransformLogic::UpdateCollimatorToGantryTransform(double collimatorRotationAngleDeg) -{ - this->CollimatorToGantryTransform->Identity(); - this->CollimatorToGantryTransform->RotateZ(collimatorRotationAngleDeg); -} - -//----------------------------------------------------------------------------- -void vtkSlicerIECTransformLogic::UpdatePatientSupportRotationToFixedReferenceTransform(double patientSupportRotationAngleDeg) -{ - this->PatientSupportRotationToFixedReferenceTransform->Identity(); - this->PatientSupportRotationToFixedReferenceTransform->RotateZ(patientSupportRotationAngleDeg); -} - -//----------------------------------------------------------------------------- -vtkTransform* vtkSlicerIECTransformLogic::GetElementaryTransformBetween( - CoordinateSystemIdentifier fromFrame, CoordinateSystemIdentifier toFrame) -{ - std::string requestedTransformName = this->GetTransformNameBetween(fromFrame, toFrame); - for (auto& transform : this->ElementaryTransforms) - { - std::string currentTransformName(transform->GetObjectName()); - if (currentTransformName == requestedTransformName) - { - return transform; - } - } - - vtkErrorMacro("GetElementaryTransformBetween: Elementary transform not found: " << requestedTransformName); - return nullptr; -} - -//----------------------------------------------------------------------------- -std::string vtkSlicerIECTransformLogic::GetTransformNameBetween( - CoordinateSystemIdentifier fromFrame, CoordinateSystemIdentifier toFrame) -{ - return this->CoordinateSystemsMap[fromFrame] + "To" + this->CoordinateSystemsMap[toFrame] + "Transform"; -} - -//----------------------------------------------------------------------------- -bool vtkSlicerIECTransformLogic::GetTransformBetween(vtkSlicerIECTransformLogic::CoordinateSystemIdentifier fromFrame, vtkSlicerIECTransformLogic::CoordinateSystemIdentifier toFrame, - vtkGeneralTransform* outputTransform, bool transformForBeam/*=false*/) -{ - if (!outputTransform) - { - vtkErrorMacro("GetTransformBetween: Invalid output transform node"); - return false; - } - - vtkSlicerIECTransformLogic::CoordinateSystemsList fromFramePath, toFramePath; - if (this->GetPathToRoot(fromFrame, fromFramePath) && this->GetPathFromRoot(toFrame, toFramePath)) - { - std::vector< vtkSlicerIECTransformLogic::CoordinateSystemIdentifier > toFrameVector(toFramePath.size()); - std::vector< vtkSlicerIECTransformLogic::CoordinateSystemIdentifier > fromFrameVector(fromFramePath.size()); - - std::copy(toFramePath.begin(), toFramePath.end(), toFrameVector.begin()); - std::copy(fromFramePath.begin(), fromFramePath.end(), fromFrameVector.begin()); - - outputTransform->Identity(); - outputTransform->PostMultiply(); - for (size_t i = 0; i < fromFrameVector.size() - 1; ++i) - { - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier parent, child; - child = fromFrameVector[i]; - parent = fromFrameVector[i + 1]; - - if (child == parent) - { - continue; - } - - vtkTransform* fromTransform = this->GetElementaryTransformBetween(child, parent); - if (fromTransform) - { - outputTransform->Concatenate(fromTransform->GetMatrix()); - } - else - { - vtkErrorMacro("GetTransformBetween: Transform node is invalid"); - return false; - } - } - - for (size_t i = 0; i < toFrameVector.size() - 1; ++i) - { - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier parent, child; - parent = toFrameVector[i]; - child = toFrameVector[i + 1]; - - if (child == parent) - { - continue; - } - - vtkTransform* toTransform = this->GetElementaryTransformBetween(child, parent); - if (toTransform) - { - vtkNew mat; - toTransform->GetMatrix(mat); - if (!transformForBeam) // Do not invert for beam transformation - { - mat->Invert(); - } - outputTransform->Concatenate(mat); - } - else - { - vtkErrorMacro("GetTransformBetween: Transform node is invalid"); - return false; - } - } - - outputTransform->Modified(); - return true; - } - - vtkErrorMacro("GetTransformBetween: Failed to get transform " << this->GetTransformNameBetween(fromFrame, toFrame)); - return false; -} - -//----------------------------------------------------------------------------- -bool vtkSlicerIECTransformLogic::GetPathToRoot(vtkSlicerIECTransformLogic::CoordinateSystemIdentifier frame, vtkSlicerIECTransformLogic::CoordinateSystemsList& path) -{ - if (frame == vtkSlicerIECTransformLogic::CoordinateSystemIdentifier::FixedReference) - { - path.push_back(vtkSlicerIECTransformLogic::FixedReference); - return true; - } - - bool found = false; - do - { - for (auto& pair : this->CoordinateSystemsHierarchy) - { - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier parent = pair.first; - - auto& children = pair.second; - auto iter = std::find(children.begin(), children.end(), frame); - if (iter != children.end()) - { - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier id = *iter; - - vtkDebugMacro("GetPathToRoot: Checking affine transformation " - << "\"" << this->CoordinateSystemsMap[id] << "\" -> " - << "\"" << this->CoordinateSystemsMap[parent] << "\""); - - frame = parent; - path.push_back(id); - if (frame != vtkSlicerIECTransformLogic::FixedReference) - { - found = true; - break; - } - else - { - path.push_back(vtkSlicerIECTransformLogic::FixedReference); - } - } - else - { - found = false; - } - } - } while (found); - - return (path.size() > 0); -} - -//----------------------------------------------------------------------------- -bool vtkSlicerIECTransformLogic::GetPathFromRoot(vtkSlicerIECTransformLogic::CoordinateSystemIdentifier frame, vtkSlicerIECTransformLogic::CoordinateSystemsList& path) -{ - if (this->GetPathToRoot(frame, path)) - { - std::reverse(path.begin(), path.end()); - return true; - } - else - { - return false; - } -} diff --git a/Beams/Logic/vtkSlicerIECTransformLogic.h b/Beams/Logic/vtkSlicerIECTransformLogic.h deleted file mode 100644 index 86ccd0b75..000000000 --- a/Beams/Logic/vtkSlicerIECTransformLogic.h +++ /dev/null @@ -1,218 +0,0 @@ -/*============================================================================== - - Copyright (c) Laboratory for Percutaneous Surgery (PerkLab) - Queen's University, Kingston, ON, Canada. All Rights Reserved. - - See COPYRIGHT.txt - or http://www.slicer.org/copyright/copyright.txt for details. - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - This file was originally developed by Vinith Suriyakumar and Csaba Pinter, - PerkLab, Queen's University and was supported through the Applied Cancer - Research Unit program of Cancer Care Ontario with funds provided by the - Ontario Ministry of Health and Long-Term Care - -==============================================================================*/ - -#ifndef __vtkSlicerIECTransformLogic_h -#define __vtkSlicerIECTransformLogic_h - -#include "vtkSlicerBeamsModuleLogicExport.h" - -// STD includes -#include -#include -#include - -// VTK includes -#include -#include - -class vtkGeneralTransform; - -/// \ingroup SlicerRt_QtModules_Beams -/// \brief Logic representing the IEC standard coordinate systems and transforms. -/// -/// The IEC standard describes coordinate systems and a transform hierarchy to -/// represent objects taking part in an external beam radiation therapy delivery in 3D space. -/// With this logic class it is possible to get a transform from any defined coordinate -/// system to another by simply inputting the coordinate systems. The logic can observe an -/// RT beam node to get the geometrical parameters defining the state of the objects involved. -/// Image describing these coordinate frames: -/// https://github.com/SlicerRt/SlicerRtDoc/blob/master/technical/IEC%2061217-2002_CoordinateSystemsDiagram_HiRes.png -/// - -/* - "IEC 61217:2011 Hierarchy" - - -------------------("f")--------------------- - | | | - ---------("g") ("i") ("s") - | | | | - ("r") ("b") ("o") ("e") - | | - ("w") ("t") - | - ("p") - -Legend: - ("f") - Fixed reference system - ("g") - GANTRY coordinate system - ("b") - BEAM LIMITING DEVICE or DELINEATOR coordinate system - ("w") - WEDGE FILTER coordinate system - ("r") - X-RAY IMAGE RECEPTOR coordinate system - ("s") - PATIENT SUPPORT coordinate system - ("e") - Table top eccentric rotation coordinate system - ("t") - Table top coordinate system - ("p") - PATIENT coordinate system - ("i") - Imager coordinate system - ("o") - Focus coordinate system - - - IEC Patient to DICOM Patient transformation: - Counter clockwise rotation around X-axis, angle = -90 - - 1 0 0 - Rotation Matrix = 0 0 -1 - 0 1 0 - - IEC Patient to RAS Patient transformation: - Counter clockwise rotation around X-axis, angle = -90 - Clockwise rotation around Z-axis, angle = 180 - - -1 0 0 - Rotation Matrix = 0 0 1 - 0 1 0 -*/ - -class VTK_SLICER_BEAMS_LOGIC_EXPORT vtkSlicerIECTransformLogic : public vtkObject -{ -public: - enum CoordinateSystemIdentifier - { - RAS = 0, - FixedReference, - Gantry, - Collimator, - LeftImagingPanel, - RightImagingPanel, - PatientSupportRotation, // Not part of the standard, but useful for visualization - PatientSupport, - TableTopEccentricRotation, - TableTop, - FlatPanel, - WedgeFilter, - Patient, - Imager, - Focus, - LastIECCoordinateFrame // Last index used for adding more coordinate systems externally - }; - typedef std::list< CoordinateSystemIdentifier > CoordinateSystemsList; - -public: - static vtkSlicerIECTransformLogic *New(); - vtkTypeMacro(vtkSlicerIECTransformLogic, vtkObject); - void PrintSelf(ostream& os, vtkIndent indent) override; - - /// Update GantryToFixedReference transform based on gantry angle parameter - void UpdateGantryToFixedReferenceTransform(double gantryRotationAngleDeg); - /// Update CollimatorToGantry transform based on collimator angle parameter - void UpdateCollimatorToGantryTransform(double collimatorRotationAngleDeg); - /// Update PatientSupportRotrationToFixedReference transform based on patient support rotation parameter - void UpdatePatientSupportRotationToFixedReferenceTransform(double patientSupportRotationAngleDeg); - - /// Get transform from one coordinate frame to another - /// @param fromFrame - start transformation from frame - /// @param toFrame - proceed transformation to frame - /// @param outputTransform - General (linear) transform matrix fromFrame -> toFrame. Matrix is correct if return flag is true. - /// @param transformForBeam - calculate dynamic transformation for beam model or other models - /// (e.g. transformation from Patient RAS frame to Collimation frame: RAS -> Patient -> TableTop -> Eccentric -> Patient Support -> Fixed reference -> Gantry -> Collimator) //TODO: Deprecated - /// \return Success flag (false on any error) - bool GetTransformBetween(CoordinateSystemIdentifier fromFrame, CoordinateSystemIdentifier toFrame, - vtkGeneralTransform* outputTransform, bool transformForBeam=false); - - /// @brief Get coordinate system identifiers from root system down to frame system - vtkTransform* GetElementaryTransformBetween(CoordinateSystemIdentifier fromFrame, CoordinateSystemIdentifier toFrame); - -public: - //std::map GetCoordinateSystemsMap() - //{ - // return CoordinateSystemsMap; - //} - - /// Get name of transform node between two coordinate systems - /// \return Transform node name between the specified coordinate frames. - /// Note: If IEC does not specify a transform between the given coordinate frames, then there will be no node with the returned name. - std::string GetTransformNameBetween(CoordinateSystemIdentifier fromFrame, CoordinateSystemIdentifier toFrame); - -public: - std::vector> GetIECTransforms() - { - return this->IECTransforms; - } - -protected: - /// @brief Get coordinate system identifiers from frame system up to root system - /// Root system = FixedReference system, see IEC 61217:2011 hierarchy - bool GetPathToRoot(CoordinateSystemIdentifier frame, CoordinateSystemsList& path); - - /// @brief Get coordinate system identifiers from root system down to frame system - /// Root system = FixedReference system, see IEC 61217:2011 hierarchy - bool GetPathFromRoot(CoordinateSystemIdentifier frame, CoordinateSystemsList& path); - -protected: - /// Map from \sa CoordinateSystemIdentifier to coordinate system name. Used for getting transforms - std::map CoordinateSystemsMap; - - /// List of IEC transforms - std::vector< std::pair > IECTransforms; - - /// Map of IEC coordinate systems hierarchy - std::map< CoordinateSystemIdentifier, std::list< CoordinateSystemIdentifier > > CoordinateSystemsHierarchy; - -protected: - vtkNew FixedReferenceToRasTransform; - vtkNew GantryToFixedReferenceTransform; - vtkNew CollimatorToGantryTransform; - vtkNew WedgeFilterToCollimatorTransform; - vtkNew LeftImagingPanelToGantryTransform; - vtkNew RightImagingPanelToGantryTransform; - vtkNew PatientSupportRotationToFixedReferenceTransform; - vtkNew PatientSupportToPatientSupportRotationTransform; - vtkNew TableTopEccentricRotationToPatientSupportRotationTransform; - vtkNew TableTopToTableTopEccentricRotationTransform; - vtkNew PatientToTableTopTransform; - vtkNew RasToPatientTransform; - vtkNew FlatPanelToGantryTransform; - - vtkNew GantryToFixedReferenceConcatenatedTransform; - vtkNew CollimatorToGantryConcatenatedTransform; - vtkNew WedgeFilterToCollimatorConcatenatedTransform; - vtkNew LeftImagingPanelToGantryConcatenatedTransform; - vtkNew RightImagingPanelToGantryConcatenatedTransform; - vtkNew FlatPanelToGantryConcatenatedTransform; - vtkNew PatientSupportRotationToFixedReferenceConcatenatedTransform; - vtkNew PatientSupportToPatientSupportRotationConcatenatedTransform; - vtkNew TableTopEccentricRotationToPatientSupportRotationConcatenatedTransform; - vtkNew TableTopToTableEccentricRotationConcatenatedTransform; - vtkNew PatientToTableTopConcatenatedTransform; - vtkNew RasToPatientConcatenatedTransform; - -protected: - vtkSlicerIECTransformLogic(); - ~vtkSlicerIECTransformLogic() override; - -private: - vtkSlicerIECTransformLogic(const vtkSlicerIECTransformLogic&) = delete; - void operator=(const vtkSlicerIECTransformLogic&) = delete; - -private: - std::vector ElementaryTransforms; -}; - -#endif diff --git a/DrrImageComputation/Logic/CMakeLists.txt b/DrrImageComputation/Logic/CMakeLists.txt index 378eefeff..ae335681b 100644 --- a/DrrImageComputation/Logic/CMakeLists.txt +++ b/DrrImageComputation/Logic/CMakeLists.txt @@ -6,6 +6,7 @@ set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_LOGIC_EXPORT set(${KIT}_INCLUDE_DIRECTORIES ${SlicerRtCommon_INCLUDE_DIRS} + ${vtkIECTransformLogic_INCLUDE_DIRS} ${vtkSlicer${MODULE_NAME}ModuleMRML_INCLUDE_DIRS} ) @@ -17,6 +18,7 @@ set(${KIT}_SRCS set(${KIT}_TARGET_LIBRARIES ${ITK_LIBRARIES} ${PLASTIMATCH_LIBRARIES} + ${vtkIECTransformLogic_LIBRARIES} vtkSlicer${MODULE_NAME}ModuleMRML vtkSlicerBeamsModuleLogic vtkSlicerPlanarImageModuleLogic diff --git a/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.cxx b/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.cxx index b595afffe..8ba5918fd 100644 --- a/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.cxx +++ b/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.cxx @@ -45,7 +45,9 @@ // SlicerRT Beams Logic includes #include -#include + +// IEC Logic include +#include // SubjectHierarchy includes #include @@ -114,7 +116,7 @@ void vtkSlicerDrrImageComputationLogic::SetMRMLSceneInternal(vtkMRMLScene * newS //----------------------------------------------------------------------------- void vtkSlicerDrrImageComputationLogic::RegisterNodes() { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("RegisterNodes: Invalid MRML scene"); @@ -223,7 +225,7 @@ void vtkSlicerDrrImageComputationLogic::ProcessMRMLNodesEvents(vtkObject* caller //---------------------------------------------------------------------------- void vtkSlicerDrrImageComputationLogic::CreateMarkupsNodes(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateMarkupsNodes: Invalid MRML scene"); @@ -334,7 +336,7 @@ void vtkSlicerDrrImageComputationLogic::CreateMarkupsNodes(vtkMRMLDrrImageComput //---------------------------------------------------------------------------- void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("UpdateMarkupsNodes: Invalid MRML scene"); @@ -357,7 +359,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput vtkMRMLTransformNode* transformNode = this->UpdateImageTransformFromBeam(beamNode); double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -388,7 +390,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput imagerMarkupsNode->SetPlaneBounds( -1. * y, y, -1. * x, x); imagerMarkupsNode->SetSize( 2. * y, 2. * x); - // Update imager boundary markups transform node if it's changed + // Update imager boundary markups transform node if it's changed vtkMRMLTransformNode* markupsTransformNode = imagerMarkupsNode->GetParentTransformNode(); if (markupsTransformNode) @@ -420,7 +422,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput imageWindowMarkupsNode->SetPlaneBounds( -1. * (r2 - r1) / 2., (r2 - r1) / 2., -1. * (c2 - c1) / 2., (c2 - c1) / 2.); imageWindowMarkupsNode->SetSize( r2 - r1, c2 - c1); - // Update image window markups transform node if it's changed + // Update image window markups transform node if it's changed vtkMRMLTransformNode* markupsTransformNode = imageWindowMarkupsNode->GetParentTransformNode(); if (markupsTransformNode) @@ -448,7 +450,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput { vectorMarkupsNode->AddControlPoint(p0); } - + p = vectorMarkupsNode->GetNthControlPointPosition(1); if (p) { @@ -459,7 +461,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput vectorMarkupsNode->AddControlPoint(p1); } - // Update imager normal vector markups transform node if it's changed + // Update imager normal vector markups transform node if it's changed vtkMRMLTransformNode* markupsTransformNode = vectorMarkupsNode->GetParentTransformNode(); if (markupsTransformNode) @@ -487,7 +489,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput { vectorMarkupsNode->AddControlPoint(p0); } - + p = vectorMarkupsNode->GetNthControlPointPosition(1); if (p) { @@ -498,7 +500,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput vectorMarkupsNode->AddControlPoint(p1); } - // Update VUP VECTOR markups transform node if it's changed + // Update VUP VECTOR markups transform node if it's changed vtkMRMLTransformNode* markupsTransformNode = vectorMarkupsNode->GetParentTransformNode(); if (markupsTransformNode) @@ -528,7 +530,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput { pointsMarkupsNode->AddControlPoint(p0); } - + p = pointsMarkupsNode->GetNthControlPointPosition(1); if (p) { @@ -538,7 +540,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput { pointsMarkupsNode->AddControlPoint(p1); } - + p = pointsMarkupsNode->GetNthControlPointPosition(2); if (p) { @@ -548,7 +550,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput { pointsMarkupsNode->AddControlPoint(p2); } - + p = pointsMarkupsNode->GetNthControlPointPosition(3); if (p) { @@ -559,7 +561,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput pointsMarkupsNode->AddControlPoint(p3); } - // Update fiducials markups transform node if it's changed + // Update fiducials markups transform node if it's changed vtkMRMLTransformNode* markupsTransformNode = pointsMarkupsNode->GetParentTransformNode(); if (markupsTransformNode) @@ -573,7 +575,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateMarkupsNodes(vtkMRMLDrrImageComput //---------------------------------------------------------------------------- void vtkSlicerDrrImageComputationLogic::ShowMarkupsNodes(bool toggled) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("ShowMarkupsNodes: Invalid MRML scene"); @@ -624,7 +626,7 @@ void vtkSlicerDrrImageComputationLogic::ShowMarkupsNodes(bool toggled) //---------------------------------------------------------------------------- vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImagerBoundary(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateImagerBoundary: Invalid MRML scene"); @@ -647,7 +649,7 @@ vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImagerBoundary if (parameterNode) { double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -689,7 +691,7 @@ vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImagerBoundary //---------------------------------------------------------------------------- vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImageWindow(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateImageWindow: Invalid MRML scene"); @@ -712,7 +714,7 @@ vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImageWindow(vt if (parameterNode) { double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -765,7 +767,7 @@ vtkMRMLMarkupsPlaneNode* vtkSlicerDrrImageComputationLogic::CreateImageWindow(vt //---------------------------------------------------------------------------- vtkMRMLMarkupsLineNode* vtkSlicerDrrImageComputationLogic::CreateImagerNormal(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateImagerNormal: Invalid MRML scene"); @@ -812,7 +814,7 @@ vtkMRMLMarkupsLineNode* vtkSlicerDrrImageComputationLogic::CreateImagerNormal(vt //---------------------------------------------------------------------------- vtkMRMLMarkupsLineNode* vtkSlicerDrrImageComputationLogic::CreateImagerVUP(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateImagerVUP: Invalid MRML scene"); @@ -835,7 +837,7 @@ vtkMRMLMarkupsLineNode* vtkSlicerDrrImageComputationLogic::CreateImagerVUP(vtkMR if (parameterNode) { double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -871,7 +873,7 @@ vtkMRMLMarkupsLineNode* vtkSlicerDrrImageComputationLogic::CreateImagerVUP(vtkMR //---------------------------------------------------------------------------- vtkMRMLMarkupsFiducialNode* vtkSlicerDrrImageComputationLogic::CreateFiducials(vtkMRMLDrrImageComputationNode* parameterNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateFiducials: Invalid MRML scene"); @@ -894,7 +896,7 @@ vtkMRMLMarkupsFiducialNode* vtkSlicerDrrImageComputationLogic::CreateFiducials(v if (parameterNode) { double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -935,10 +937,10 @@ vtkMRMLMarkupsFiducialNode* vtkSlicerDrrImageComputationLogic::CreateFiducials(v } //------------------------------------------------------------------------------ -vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDRR( vtkMRMLDrrImageComputationNode* parameterNode, +vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDRR( vtkMRMLDrrImageComputationNode* parameterNode, vtkMRMLScalarVolumeNode* ctVolumeNode) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("ComputePlastimatchDRR: Invalid MRML scene"); @@ -1004,7 +1006,7 @@ vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDR parameterNode->GetIsocenterPositionLPS(isocenter); isocenterStream << isocenter[0] << "," << isocenter[1] << "," << isocenter[2]; cmdNode->SetParameterAsString( "isocenterPosition", isocenterStream.str()); - + std::stringstream imagerResolutionStream; int imagerResolution[2] = { 1024, 768 }; parameterNode->GetImagerResolution(imagerResolution); @@ -1028,7 +1030,7 @@ vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDR } cmdNode->SetParameterAsBool( "autoscale", parameterNode->GetAutoscaleFlag()); - + std::stringstream autoscaleRangeStream; float autoscaleRange[2] = { 0., 255. }; parameterNode->GetAutoscaleRange(autoscaleRange); @@ -1037,7 +1039,7 @@ vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDR cmdNode->SetParameterAsBool( "exponentialMapping", parameterNode->GetExponentialMappingFlag()); cmdNode->SetParameterAsInt( "thresholdBelow", parameterNode->GetHUThresholdBelow()); - + std::string threadingString = "cpu"; switch (parameterNode->GetThreading()) { @@ -1114,7 +1116,7 @@ vtkMRMLScalarVolumeNode* vtkSlicerDrrImageComputationLogic::ComputePlastimatchDR } //------------------------------------------------------------------------------ -bool vtkSlicerDrrImageComputationLogic::SetupDisplayAndSubjectHierarchyNodes( vtkMRMLDrrImageComputationNode* parameterNode, +bool vtkSlicerDrrImageComputationLogic::SetupDisplayAndSubjectHierarchyNodes( vtkMRMLDrrImageComputationNode* parameterNode, vtkMRMLScalarVolumeNode* drrVolumeNode) { vtkMRMLRTBeamNode* beamNode = parameterNode->GetBeamNode(); @@ -1133,7 +1135,7 @@ bool vtkSlicerDrrImageComputationLogic::SetupDisplayAndSubjectHierarchyNodes( vt float autoscaleRange[2] = { 0.f, 255.f }; parameterNode->GetAutoscaleRange(autoscaleRange); - + // TODO: add manual level setting volumeDisplayNode->AutoWindowLevelOn(); @@ -1158,7 +1160,7 @@ bool vtkSlicerDrrImageComputationLogic::SetupDisplayAndSubjectHierarchyNodes( vt std::string rtImagePositionString = std::to_string(rtImagePosition[0]) + std::string(" ") + std::to_string(rtImagePosition[1]); shNode->SetItemAttribute(rtImageVolumeShItemID, vtkSlicerRtCommon::DICOMRTIMPORT_RTIMAGE_POSITION_ATTRIBUTE_NAME, rtImagePositionString); - // Compute and set RT image geometry. Uses the referenced beam + // Compute and set RT image geometry. Uses the referenced beam return this->SetupGeometry( parameterNode, drrVolumeNode); } @@ -1295,7 +1297,7 @@ bool vtkSlicerDrrImageComputationLogic::SetupGeometry( vtkMRMLDrrImageComputatio //------------------------------------------------------------------------------ bool vtkSlicerDrrImageComputationLogic::GetRtImageIJKToRASMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetRtImageIJKToRASMatrix: Invalid MRML scene"); @@ -1394,7 +1396,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRtImageIJKToRASMatrix(vtkMRMLDrrImage bool vtkSlicerDrrImageComputationLogic::GetRayIntersectWithImagerPlane(vtkMRMLDrrImageComputationNode* parameterNode, const double point[3], double pointIntersect[3]) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetRayIntersectWithImagerPlane: Invalid MRML scene"); @@ -1415,7 +1417,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRayIntersectWithImagerPlane(vtkMRMLDr } double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -1511,7 +1513,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRtImageTransformMatrix(vtkMRMLDrrImag //------------------------------------------------------------------------------ bool vtkSlicerDrrImageComputationLogic::GetPlastimatchIntrinsicMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetPlastimatchIntrinsicMatrix: Invalid MRML scene"); @@ -1544,7 +1546,7 @@ bool vtkSlicerDrrImageComputationLogic::GetPlastimatchIntrinsicMatrix(vtkMRMLDrr //------------------------------------------------------------------------------ bool vtkSlicerDrrImageComputationLogic::GetPlastimatchExtrinsicMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetPlastimatchExtrinsicMatrix: Invalid MRML scene"); @@ -1664,13 +1666,15 @@ vtkMRMLLinearTransformNode* vtkSlicerDrrImageComputationLogic::UpdateImageTransf scene->GetFirstNodeByName(RTIMAGE_TRANSFORM_NODE_NAME)); } + vtkNew iecLogic; + // Update transforms in IEC logic from beam node parameters beamsLogic->UpdateIECTransformsFromBeam(beamNode); // Dynamic transform from Gantry to RAS // Transformation path: // Gantry -> FixedReference -> PatientSupport -> TableTopEccentricRotation -> TableTop -> Patient -> RAS - using IEC = vtkSlicerIECTransformLogic::CoordinateSystemIdentifier; + using IEC = vtkIECTransformLogic::CoordinateSystemIdentifier; vtkNew generalTransform; if (beamsLogic->GetIECLogic()->GetTransformBetween(IEC::Gantry, IEC::RAS, generalTransform, true)) { @@ -1709,7 +1713,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRtImageTransformMatrixFromBeam(vtkMRM return false; } - vtkNew iecLogic; + vtkNew iecLogic; // Update transforms in IEC logic from beam node parameters beamsLogic->UpdateIECTransformsFromBeam(beamNode); @@ -1720,7 +1724,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRtImageTransformMatrixFromBeam(vtkMRM // Dynamic transform from Gantry to RAS // Transformation path: // Gantry -> FixedReference -> PatientSupport -> TableTopEccentricRotation -> TableTop -> Patient -> RAS - using IEC = vtkSlicerIECTransformLogic::CoordinateSystemIdentifier; + using IEC = vtkIECTransformLogic::CoordinateSystemIdentifier; vtkNew generalTransform; if (iecLogic->GetTransformBetween(IEC::Gantry, IEC::RAS, generalTransform, true)) { @@ -1779,7 +1783,7 @@ void vtkSlicerDrrImageComputationLogic::UpdateNormalAndVupVectors(vtkMRMLDrrImag vtkNew rasToLpsTransform; rasToLpsTransform->Identity(); rasToLpsTransform->RotateZ(180.0); - + vtkNew dicomBeamTransform; dicomBeamTransform->Identity(); dicomBeamTransform->PreMultiply(); @@ -1830,7 +1834,7 @@ bool vtkSlicerDrrImageComputationLogic::UpdateBeamFromCamera(vtkMRMLDrrImageComp return false; } - // Transform RAS to IEC Patient + // Transform RAS to IEC Patient vtkNew rasToPatientTransform; rasToPatientTransform->Identity(); rasToPatientTransform->RotateX(-90.); @@ -1884,7 +1888,7 @@ bool vtkSlicerDrrImageComputationLogic::UpdateBeamFromCamera(vtkMRMLDrrImageComp //------------------------------------------------------------------------------ bool vtkSlicerDrrImageComputationLogic::GetRtImagerOriginPosition(vtkMRMLDrrImageComputationNode* parameterNode, double originPositionRAS[3]) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetRayIntersectWithImagerPlane: Invalid MRML scene"); @@ -1905,7 +1909,7 @@ bool vtkSlicerDrrImageComputationLogic::GetRtImagerOriginPosition(vtkMRMLDrrImag } double distance = parameterNode->GetIsocenterImagerDistance(); - + double spacing[2] = {}; parameterNode->GetImagerSpacing(spacing); @@ -1942,7 +1946,7 @@ bool vtkSlicerDrrImageComputationLogic::GetPointOffsetFromImagerOrigin( vtkMRMLDrrImageComputationNode* parameterNode, const double pointRAS[3], double widthHeightOffset[2], double columnRowOffset[2]) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("GetPointOffsetFromImagerOrigin: Invalid MRML scene"); @@ -1961,7 +1965,7 @@ bool vtkSlicerDrrImageComputationLogic::GetPointOffsetFromImagerOrigin( vtkErrorMacro("GetPointOffsetFromImagerOrigin: Invalid RT Beam node"); return false; } - + vtkNew rtImageTransformMatrix; if (!this->GetRtImageTransformMatrixFromBeam(beamNode, rtImageTransformMatrix)) { @@ -2001,7 +2005,7 @@ bool vtkSlicerDrrImageComputationLogic::GetPointOffsetFromImagerOrigin( vtkMRMLTableNode* vtkSlicerDrrImageComputationLogic::CreateProjectionsTableNode( vtkMRMLDrrImageComputationNode* parameterNode, vtkMRMLScalarVolumeNode* ctInputVolume) { - vtkMRMLScene* scene = this->GetMRMLScene(); + vtkMRMLScene* scene = this->GetMRMLScene(); if (!scene) { vtkErrorMacro("CreateProjectionsTableNode: Invalid MRML scene"); diff --git a/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.h b/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.h index dda2fd3de..a52b8493e 100644 --- a/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.h +++ b/DrrImageComputation/Logic/vtkSlicerDrrImageComputationLogic.h @@ -27,13 +27,11 @@ // Slicer includes #include -// SlicerRT includes -#include - // STD includes #include #include "vtkSlicerDrrImageComputationModuleLogicExport.h" +#include class vtkMRMLVolumeNode; class vtkMRMLScalarVolumeNode; @@ -85,7 +83,7 @@ class VTK_SLICER_DRRIMAGECOMPUTATION_MODULE_LOGIC_EXPORT vtkSlicerDrrImageComput /// Compute DRR image /// \param parameterNode - parameters of DRR image computation /// \param ctInputVolume - CT volume - /// \return valid computed DRR volume node or nullptr otherwise + /// \return valid computed DRR volume node or nullptr otherwise vtkMRMLScalarVolumeNode* ComputePlastimatchDRR(vtkMRMLDrrImageComputationNode* parameterNode, vtkMRMLScalarVolumeNode* ctInputVolume); /// Update Beam node from 3D view camera position @@ -96,31 +94,31 @@ class VTK_SLICER_DRRIMAGECOMPUTATION_MODULE_LOGIC_EXPORT vtkSlicerDrrImageComput /// Get transformation matrix for RT-Image /// \param parameterNode - parameters of DRR image computation /// \param mat - linear transformation matrix - /// \return - true if matrix is valid, false otherwise + /// \return - true if matrix is valid, false otherwise bool GetRtImageTransformMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat); /// Get plastimatch intrinsic matrix component /// \param parameterNode - parameters of DRR image computation /// \param mat - linear transformation matrix - /// \return - true if matrix is valid, false otherwise + /// \return - true if matrix is valid, false otherwise bool GetPlastimatchIntrinsicMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat); /// Get plastimatch extrinsic matrix component /// \param parameterNode - parameters of DRR image computation /// \param mat - linear transformation matrix - /// \return - true if matrix is valid, false otherwise + /// \return - true if matrix is valid, false otherwise bool GetPlastimatchExtrinsicMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat); /// Get plastimatch projection matrix /// \param parameterNode - parameters of DRR image computation /// \param mat - linear transformation matrix - /// \return - true if matrix is valid, false otherwise + /// \return - true if matrix is valid, false otherwise bool GetPlastimatchProjectionMatrix(vtkMRMLDrrImageComputationNode* parameterNode, vtkMatrix4x4* mat); /// Get plastimatch projection matrix /// \param parameterNode - parameters of DRR image computation /// \param mat - linear transformation matrix - /// \return - true if matrix is valid, false otherwise + /// \return - true if matrix is valid, false otherwise bool GetPointOffsetFromImagerOrigin(vtkMRMLDrrImageComputationNode* parameterNode, const double pointRAS[3], double offsetWidthHeight[2], double offsetColumnRow[2]); @@ -130,7 +128,7 @@ class VTK_SLICER_DRRIMAGECOMPUTATION_MODULE_LOGIC_EXPORT vtkSlicerDrrImageComput /// \param parameterNode - parameters of DRR image computation /// \param point - second ray point coordinates in RAS /// \param pointIntersect - intersection coordinates of point ray and imager plane in RAS - /// \return - true if there is an intersection, false otherwise + /// \return - true if there is an intersection, false otherwise bool GetRayIntersectWithImagerPlane(vtkMRMLDrrImageComputationNode* parameterNode, const double pointRAS[3], double pointIntersectRAS[3]); @@ -168,7 +166,7 @@ class VTK_SLICER_DRRIMAGECOMPUTATION_MODULE_LOGIC_EXPORT vtkSlicerDrrImageComput vtkSlicerDrrImageComputationLogic(const vtkSlicerDrrImageComputationLogic&) = delete; // Not implemented void operator=(const vtkSlicerDrrImageComputationLogic&) = delete; // Not implemented - /// Create markups for imager normal vector + /// Create markups for imager normal vector vtkMRMLMarkupsLineNode* CreateImagerNormal(vtkMRMLDrrImageComputationNode* node); // n /// Create markups for view up normal vector vtkMRMLMarkupsLineNode* CreateImagerVUP(vtkMRMLDrrImageComputationNode* node); // vup diff --git a/ExternalBeamPlanning/Logic/CMakeLists.txt b/ExternalBeamPlanning/Logic/CMakeLists.txt index 0cbb16520..266e6edec 100644 --- a/ExternalBeamPlanning/Logic/CMakeLists.txt +++ b/ExternalBeamPlanning/Logic/CMakeLists.txt @@ -7,6 +7,7 @@ set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_LOGIC_EXPORT set(${KIT}_INCLUDE_DIRECTORIES ${PlmCommon_INCLUDE_DIRS} ${SlicerRtCommon_INCLUDE_DIRS} + ${vtkIECTransformLogic_INCLUDE_DIRS} ) set(${KIT}_SRCS @@ -22,6 +23,7 @@ set(${KIT}_TARGET_LIBRARIES vtkSlicerMarkupsModuleMRML vtkSlicerBeamsModuleMRML vtkSlicerBeamsModuleLogic + ${vtkIECTransformLogic_LIBRARIES} ) #----------------------------------------------------------------------------- diff --git a/ExternalBeamPlanning/Logic/vtkSlicerExternalBeamPlanningModuleLogic.cxx b/ExternalBeamPlanning/Logic/vtkSlicerExternalBeamPlanningModuleLogic.cxx index 440617384..75b72d934 100644 --- a/ExternalBeamPlanning/Logic/vtkSlicerExternalBeamPlanningModuleLogic.cxx +++ b/ExternalBeamPlanning/Logic/vtkSlicerExternalBeamPlanningModuleLogic.cxx @@ -25,7 +25,7 @@ #include "vtkMRMLRTPlanNode.h" #include "vtkMRMLRTBeamNode.h" #include "vtkSlicerBeamsModuleLogic.h" -#include "vtkSlicerIECTransformLogic.h" +#include "vtkIECTransformLogic.h" // MRML includes //#include //TODO: Includes commented out due to obsolete methods, see below diff --git a/RoomsEyeView/Logic/CMakeLists.txt b/RoomsEyeView/Logic/CMakeLists.txt index 95f2db679..50e74b13e 100644 --- a/RoomsEyeView/Logic/CMakeLists.txt +++ b/RoomsEyeView/Logic/CMakeLists.txt @@ -10,6 +10,7 @@ set(${KIT}_INCLUDE_DIRECTORIES ${vtkSlicerBeamsModuleMRML_INCLUDE_DIRS} ${vtkSlicerBeamsModuleLogic_INCLUDE_DIRS} ${RapidJSON_INCLUDE_DIR} + ${vtkIECTransformLogic_INCLUDE_DIRS} ) set(${KIT}_SRCS diff --git a/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.cxx b/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.cxx index 48a785696..10dd70e87 100644 --- a/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.cxx +++ b/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.cxx @@ -70,7 +70,7 @@ const char* vtkSlicerRoomsEyeViewModuleLogic::ORIENTATION_MARKER_MODEL_NODE_NAME = "RoomsEyeViewOrientationMarker"; const char* vtkSlicerRoomsEyeViewModuleLogic::TREATMENT_MACHINE_DESCRIPTOR_FILE_PATH_ATTRIBUTE_NAME = "TreatmentMachineDescriptorFilePath"; unsigned int vtkSlicerRoomsEyeViewModuleLogic::MAX_TRIANGLE_NUMBER_PRODUCT_FOR_COLLISIONS = 1e10; - +//TODO: Add this dynamically to the IEC transform map static rapidjson::Value JSON_EMPTY_VALUE; @@ -318,7 +318,7 @@ vtkSlicerRoomsEyeViewModuleLogic::vtkSlicerRoomsEyeViewModuleLogic() { this->Internal = new vtkInternal(this); - this->IECLogic = vtkSlicerIECTransformLogic::New(); + this->IECLogic = vtkIECTransformLogic::New(); this->GantryPatientCollisionDetection = vtkCollisionDetectionFilter::New(); this->GantryPatientCollisionDetection->SetCollisionModeToFirstContact(); @@ -376,18 +376,13 @@ void vtkSlicerRoomsEyeViewModuleLogic::PrintSelf(ostream& os, vtkIndent indent) // Transforms os << indent << "Transforms:" << std::endl; vtkSmartPointer matrix = vtkSmartPointer::New(); - for (auto& transformPair : IECLogic->vtkSlicerIECTransformLogic::GetIECTransforms()) + for (auto& transformPair : IECLogic->vtkIECTransformLogic::GetIECTransforms()) { std::string transformName = IECLogic->GetTransformNameBetween(transformPair.first, transformPair.second); vtkMRMLLinearTransformNode* transformNode = vtkMRMLLinearTransformNode::SafeDownCast( this->GetMRMLScene()->GetFirstNodeByName(transformName.c_str())); os << indent.GetNextIndent() << transformName << std::endl; - if (transformNode == nullptr) - { - os << indent.GetNextIndent() << indent.GetNextIndent() << "Not available" << std::endl; - continue; - } transformNode->GetMatrixTransformToParent(matrix); for (int i = 0; i < 4; i++) { @@ -424,7 +419,7 @@ void vtkSlicerRoomsEyeViewModuleLogic::SetMRMLSceneInternal(vtkMRMLScene* newSce //----------------------------------------------------------------------------- vtkMRMLLinearTransformNode* vtkSlicerRoomsEyeViewModuleLogic::GetTransformNodeBetween( - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier fromFrame, vtkSlicerIECTransformLogic::CoordinateSystemIdentifier toFrame) + vtkIECTransformLogic::CoordinateSystemIdentifier fromFrame, vtkIECTransformLogic::CoordinateSystemIdentifier toFrame) { if (!this->GetMRMLScene()) { @@ -489,131 +484,131 @@ void vtkSlicerRoomsEyeViewModuleLogic::BuildRoomsEyeViewTransformHierarchy() // Organize transform nodes into hierarchy based on IEC Standard 61217 (duplicate IEC logic in MRML). // Set and observe individual transforms from IEC logic to the MRML nodes. - vtkMRMLLinearTransformNode* fixedReferenceToRASTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS); + vtkMRMLLinearTransformNode* fixedReferenceToRASTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS); if (fixedReferenceToRASTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Fixed reference to RAS transform"); return; } - fixedReferenceToRASTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS)); + fixedReferenceToRASTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS)); - vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference); + vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference); if (gantryToFixedReferenceTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Gantry to Fixed reference transform"); return; } - gantryToFixedReferenceTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference)); + gantryToFixedReferenceTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference)); gantryToFixedReferenceTransformNode->SetAndObserveTransformNodeID(fixedReferenceToRASTransformNode->GetID()); - vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry); + vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry); if (collimatorToGantryTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Collimator to Gantry transform"); return; } - collimatorToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry)); + collimatorToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry)); collimatorToGantryTransformNode->SetAndObserveTransformNodeID(gantryToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* wedgeFilterToCollimatorTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::WedgeFilter, vtkSlicerIECTransformLogic::Collimator); + vtkMRMLLinearTransformNode* wedgeFilterToCollimatorTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::WedgeFilter, vtkIECTransformLogic::Collimator); if (wedgeFilterToCollimatorTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Wedge filter to Collimator transform"); return; } - wedgeFilterToCollimatorTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::WedgeFilter, vtkSlicerIECTransformLogic::Collimator)); + wedgeFilterToCollimatorTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::WedgeFilter, vtkIECTransformLogic::Collimator)); wedgeFilterToCollimatorTransformNode->SetAndObserveTransformNodeID(collimatorToGantryTransformNode->GetID()); - vtkMRMLLinearTransformNode* leftImagingPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::LeftImagingPanel, vtkSlicerIECTransformLogic::Gantry); + vtkMRMLLinearTransformNode* leftImagingPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::LeftImagingPanel, vtkIECTransformLogic::Gantry); if (leftImagingPanelToGantryTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Left imaging panel to Gantry transform"); return; } - leftImagingPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::LeftImagingPanel, vtkSlicerIECTransformLogic::Gantry)); + leftImagingPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::LeftImagingPanel, vtkIECTransformLogic::Gantry)); leftImagingPanelToGantryTransformNode->SetAndObserveTransformNodeID(gantryToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* rightImagingPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::RightImagingPanel, vtkSlicerIECTransformLogic::Gantry); + vtkMRMLLinearTransformNode* rightImagingPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::RightImagingPanel, vtkIECTransformLogic::Gantry); if (rightImagingPanelToGantryTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Right imaging panel to Gantry transform"); return; } - rightImagingPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::RightImagingPanel, vtkSlicerIECTransformLogic::Gantry)); + rightImagingPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::RightImagingPanel, vtkIECTransformLogic::Gantry)); rightImagingPanelToGantryTransformNode->SetAndObserveTransformNodeID(gantryToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* flatPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FlatPanel, vtkSlicerIECTransformLogic::Gantry); + vtkMRMLLinearTransformNode* flatPanelToGantryTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::FlatPanel, vtkIECTransformLogic::Gantry); if (flatPanelToGantryTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Flat panel to Gantry transform"); return; } - flatPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::FlatPanel, vtkSlicerIECTransformLogic::Gantry)); + flatPanelToGantryTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::FlatPanel, vtkIECTransformLogic::Gantry)); flatPanelToGantryTransformNode->SetAndObserveTransformNodeID(gantryToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* patientSupportRotationToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference); + vtkMRMLLinearTransformNode* patientSupportRotationToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference); if (patientSupportRotationToFixedReferenceTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Patient support rotation to Fixed reference transform"); return; } - patientSupportRotationToFixedReferenceTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference)); + patientSupportRotationToFixedReferenceTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference)); patientSupportRotationToFixedReferenceTransformNode->SetAndObserveTransformNodeID(fixedReferenceToRASTransformNode->GetID()); - vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation); + vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation); if (patientSupportToPatientSupportRotationTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Patient support to Patient support rotation transform"); return; } - patientSupportToPatientSupportRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation)); + patientSupportToPatientSupportRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation)); patientSupportToPatientSupportRotationTransformNode->SetAndObserveTransformNodeID(patientSupportRotationToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* tableTopEccentricRotationToPatientSupportRotationTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTopEccentricRotation, vtkSlicerIECTransformLogic::PatientSupportRotation); + vtkMRMLLinearTransformNode* tableTopEccentricRotationToPatientSupportRotationTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::TableTopEccentricRotation, vtkIECTransformLogic::PatientSupportRotation); if (tableTopEccentricRotationToPatientSupportRotationTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Table top eccentric rotation to Patient support rotation transform"); return; } - tableTopEccentricRotationToPatientSupportRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::TableTopEccentricRotation, vtkSlicerIECTransformLogic::PatientSupportRotation)); + tableTopEccentricRotationToPatientSupportRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::TableTopEccentricRotation, vtkIECTransformLogic::PatientSupportRotation)); tableTopEccentricRotationToPatientSupportRotationTransformNode->SetAndObserveTransformNodeID(patientSupportRotationToFixedReferenceTransformNode->GetID()); - vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); if (tableTopToTableTopEccentricRotationTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Table top to Table top eccentric rotation transform"); return; } - tableTopToTableTopEccentricRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation)); + tableTopToTableTopEccentricRotationTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation)); tableTopToTableTopEccentricRotationTransformNode->SetAndObserveTransformNodeID(tableTopEccentricRotationToPatientSupportRotationTransformNode->GetID()); - vtkMRMLLinearTransformNode* patientToTableTopTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Patient, vtkSlicerIECTransformLogic::TableTop); + vtkMRMLLinearTransformNode* patientToTableTopTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::Patient, vtkIECTransformLogic::TableTop); if (patientToTableTopTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access Patient to Table top transform"); return; } - patientToTableTopTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::Patient, vtkSlicerIECTransformLogic::TableTop)); + patientToTableTopTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::Patient, vtkIECTransformLogic::TableTop)); patientToTableTopTransformNode->SetAndObserveTransformNodeID(tableTopToTableTopEccentricRotationTransformNode->GetID()); - vtkMRMLLinearTransformNode* rasToPatientTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::RAS, vtkSlicerIECTransformLogic::Patient); + vtkMRMLLinearTransformNode* rasToPatientTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::RAS, vtkIECTransformLogic::Patient); if (rasToPatientTransformNode == nullptr) { vtkErrorMacro("BuildRoomsEyeViewTransformHierarchy: Failed to access RAS to Patient transform"); return; } - rasToPatientTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkSlicerIECTransformLogic::RAS, vtkSlicerIECTransformLogic::Patient)); + rasToPatientTransformNode->SetAndObserveTransformToParent(this->IECLogic->GetElementaryTransformBetween(vtkIECTransformLogic::RAS, vtkIECTransformLogic::Patient)); rasToPatientTransformNode->SetAndObserveTransformNodeID(patientToTableTopTransformNode->GetID()); @@ -705,6 +700,12 @@ vtkSlicerRoomsEyeViewModuleLogic::SetupTreatmentMachineModels(vtkMRMLRoomsEyeVie vtkErrorMacro("SetupTreatmentMachineModels: Invalid scene"); return std::vector(); } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("SetupTreatmentMachineModels: Beams logic cannot be accessed"); + return std::vector(); + } std::vector loadedParts; std::map loadedPartsNumTriangles; @@ -753,7 +754,7 @@ vtkSlicerRoomsEyeViewModuleLogic::SetupTreatmentMachineModels(vtkMRMLRoomsEyeVie if (partIdx == Collimator) { vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry); partModel->SetAndObserveTransformNodeID(collimatorToGantryTransformNode->GetID()); this->CollimatorTableTopCollisionDetection->SetInputData(0, partModel->GetPolyData()); // Patient model is set when calculating collisions, as it can be changed dynamically @@ -762,7 +763,7 @@ vtkSlicerRoomsEyeViewModuleLogic::SetupTreatmentMachineModels(vtkMRMLRoomsEyeVie else if (partIdx == Gantry) { vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference); + this->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference); partModel->SetAndObserveTransformNodeID(gantryToFixedReferenceTransformNode->GetID()); this->GantryTableTopCollisionDetection->SetInputData(0, partModel->GetPolyData()); this->GantryPatientSupportCollisionDetection->SetInputData(0, partModel->GetPolyData()); @@ -772,14 +773,14 @@ vtkSlicerRoomsEyeViewModuleLogic::SetupTreatmentMachineModels(vtkMRMLRoomsEyeVie else if (partIdx == PatientSupport) { vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation); partModel->SetAndObserveTransformNodeID(patientSupportToPatientSupportRotationTransformNode->GetID()); this->GantryPatientSupportCollisionDetection->SetInputData(1, partModel->GetPolyData()); } else if (partIdx == TableTop) { vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); partModel->SetAndObserveTransformNodeID(tableTopToTableTopEccentricRotationTransformNode->GetID()); this->GantryTableTopCollisionDetection->SetInputData(1, partModel->GetPolyData()); this->CollimatorTableTopCollisionDetection->SetInputData(1, partModel->GetPolyData()); @@ -787,25 +788,25 @@ vtkSlicerRoomsEyeViewModuleLogic::SetupTreatmentMachineModels(vtkMRMLRoomsEyeVie else if (partIdx == Body) { vtkMRMLLinearTransformNode* fixedReferenceToRasTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS); + this->GetTransformNodeBetween(vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS); partModel->SetAndObserveTransformNodeID(fixedReferenceToRasTransformNode->GetID()); } else if (partIdx == ImagingPanelLeft) { vtkMRMLLinearTransformNode* leftImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::LeftImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::LeftImagingPanel, vtkIECTransformLogic::Gantry); partModel->SetAndObserveTransformNodeID(leftImagingPanelToGantryTransformNode->GetID()); } else if (partIdx == ImagingPanelRight) { vtkMRMLLinearTransformNode* rightImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::RightImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::RightImagingPanel, vtkIECTransformLogic::Gantry); partModel->SetAndObserveTransformNodeID(rightImagingPanelToGantryTransformNode->GetID()); } else if (partIdx == FlatPanel) { vtkMRMLLinearTransformNode* flatPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FlatPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::FlatPanel, vtkIECTransformLogic::Gantry); partModel->SetAndObserveTransformNodeID(flatPanelToGantryTransformNode->GetID()); } //TODO: ApplicatorHolder, ElectronApplicator? @@ -852,6 +853,12 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa vtkErrorMacro("UpdateTreatmentOrientationMarker: Invalid scene"); return nullptr; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateTreatmentOrientationMarker: Beams logic cannot be accessed"); + return nullptr; + } std::string machineType = this->Internal->GetTreatmentMachineFileNameWithoutExtension(parameterNode); @@ -877,7 +884,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa gantryModelPolyData->DeepCopy(gantryModel->GetPolyData()); vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference); + this->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference); vtkNew gantryTransformFilter; gantryTransformFilter->SetInputData(gantryModelPolyData); vtkNew gantryToFixedReferenceTransform; @@ -893,7 +900,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa collimatorModelPolyData->DeepCopy(collimatorModel->GetPolyData()); vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry); vtkNew collimatorTransformFilter; collimatorTransformFilter->SetInputData(collimatorModelPolyData); vtkNew collimatorToGantryTransform; @@ -909,7 +916,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa patientSupportModelPolyData->DeepCopy(patientSupportModel->GetPolyData()); vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation); vtkNew patientSupportTransformFilter; patientSupportTransformFilter->SetInputData(patientSupportModelPolyData); vtkNew patientSupportToPatientSupportRotationTransform; @@ -925,7 +932,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa tableTopModelPolyData->DeepCopy(tableTopModel->GetPolyData()); vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkNew tableTopTransformFilter; tableTopTransformFilter->SetInputData(tableTopModelPolyData); vtkNew tableTopModelTransform; @@ -944,7 +951,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa leftImagingPanelModelPolyData->DeepCopy(imagingPanelLeftModel->GetPolyData()); vtkMRMLLinearTransformNode* leftImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::LeftImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::LeftImagingPanel, vtkIECTransformLogic::Gantry); vtkNew leftImagingPanelTransformFilter; leftImagingPanelTransformFilter->SetInputData(leftImagingPanelModelPolyData); vtkNew leftImagingPanelToGantryTransform; @@ -963,7 +970,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa rightImagingPanelModelPolyData->DeepCopy(imagingPanelRightModel->GetPolyData()); vtkMRMLLinearTransformNode* rightImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::RightImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::RightImagingPanel, vtkIECTransformLogic::Gantry); vtkNew rightImagingPanelTransformFilter; rightImagingPanelTransformFilter->SetInputData(rightImagingPanelModelPolyData); vtkNew rightImagingPanelToGantryTransform; @@ -982,7 +989,7 @@ vtkMRMLModelNode* vtkSlicerRoomsEyeViewModuleLogic::UpdateTreatmentOrientationMa flatPanelModelPolyData->DeepCopy(flatPanelModel->GetPolyData()); vtkMRMLLinearTransformNode* flatPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FlatPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::FlatPanel, vtkIECTransformLogic::Gantry); vtkNew flatPanelTransformFilter; flatPanelTransformFilter->SetInputData(flatPanelModelPolyData); vtkNew flatPanelToGantryTransform; @@ -1048,9 +1055,15 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateGantryToFixedReferenceTransform(vtk vtkErrorMacro("UpdateGantryToFixedReferenceTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateGantryToFixedReferenceTransform: Beams logic cannot be accessed"); + return; + } this->IECLogic->UpdateGantryToFixedReferenceTransform(parameterNode->GetGantryRotationAngle()); - vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference); + vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference); gantryToFixedReferenceTransformNode->Modified(); // Modified call is needed because it does not update display in app } @@ -1062,9 +1075,15 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateCollimatorToGantryTransform(vtkMRML vtkErrorMacro("UpdateCollimatorToGantryTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateCollimatorToGantryTransform: Beams logic cannot be accessed"); + return; + } this->IECLogic->UpdateCollimatorToGantryTransform(parameterNode->GetCollimatorRotationAngle()); - vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry); + vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry); collimatorToGantryTransformNode->Modified(); // Modified call is needed because it does not update display in app } @@ -1076,6 +1095,12 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateLeftImagingPanelToGantryTransform(v vtkErrorMacro("UpdateLeftImagingPanelToGantryTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateLeftImagingPanelToGantryTransform: Beams logic cannot be accessed"); + return; + } std::string machineType = this->Internal->GetTreatmentMachineFileNameWithoutExtension(parameterNode); @@ -1132,7 +1157,7 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateLeftImagingPanelToGantryTransform(v // Assemble transform and update node vtkMRMLLinearTransformNode* leftImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::LeftImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::LeftImagingPanel, vtkIECTransformLogic::Gantry); vtkNew leftImagingPanelToGantryTransform; leftImagingPanelToGantryTransform->PostMultiply(); leftImagingPanelToGantryTransform->Concatenate(leftImagingPanelToRasTransform); @@ -1150,6 +1175,12 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateRightImagingPanelToGantryTransform( vtkErrorMacro("UpdateRightImagingPanelToGantryTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateRightImagingPanelToGantryTransform: Beams logic cannot be accessed"); + return; + } std::string machineType = this->Internal->GetTreatmentMachineFileNameWithoutExtension(parameterNode); @@ -1204,7 +1235,7 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateRightImagingPanelToGantryTransform( // Assemble transform and update node vtkMRMLLinearTransformNode* rightImagingPanelToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::RightImagingPanel, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::RightImagingPanel, vtkIECTransformLogic::Gantry); vtkNew rightImagingPanelToGantryTransform; rightImagingPanelToGantryTransform->PostMultiply(); rightImagingPanelToGantryTransform->Concatenate(rightImagingPanelToRasTransform); @@ -1235,9 +1266,15 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdatePatientSupportRotationToFixedRefere vtkErrorMacro("UpdatePatientSupportRotationToFixedReferenceTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdatePatientSupportRotationToFixedReferenceTransform: Beams logic cannot be accessed"); + return; + } this->IECLogic->UpdatePatientSupportRotationToFixedReferenceTransform(parameterNode->GetPatientSupportRotationAngle()); - vtkMRMLLinearTransformNode* patientSupportRotationToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference); + vtkMRMLLinearTransformNode* patientSupportRotationToFixedReferenceTransformNode = this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference); patientSupportRotationToFixedReferenceTransformNode->Modified(); // Modified call is needed because it does not update display in app } @@ -1249,6 +1286,12 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdatePatientSupportToPatientSupportRotat vtkErrorMacro("UpdatePatientSupportToPatientSupportRotationTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdatePatientSupportToPatientSupportRotationTransform: Beams logic cannot be accessed"); + return; + } std::string machineType = this->Internal->GetTreatmentMachineFileNameWithoutExtension(parameterNode); @@ -1283,7 +1326,7 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdatePatientSupportToPatientSupportRotat patientSupportScalingTransform->Translate(patientSupportTranslationFromOrigin); vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation); patientSupportToPatientSupportRotationTransformNode->SetAndObserveTransformToParent(patientSupportScalingTransform); patientSupportToPatientSupportRotationTransformNode->Modified(); // Modified call is needed because it does not update display in app } @@ -1302,9 +1345,15 @@ void vtkSlicerRoomsEyeViewModuleLogic::UpdateTableTopToTableTopEccentricRotation vtkErrorMacro("UpdateTableTopToTableTopEccentricRotationTransform: Invalid parameter set node"); return; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("UpdateTableTopToTableTopEccentricRotationTransform: Beams logic cannot be accessed"); + return; + } vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode->GetTransformToParent() ); @@ -1327,6 +1376,13 @@ std::string vtkSlicerRoomsEyeViewModuleLogic::CheckForCollisions(vtkMRMLRoomsEye vtkErrorMacro("CheckForCollisions: Invalid parameter set node"); return "Invalid parameters"; } + vtkSlicerBeamsModuleLogic* beamsLogic = this->GetBeamsLogic(); + if (!beamsLogic) + { + vtkErrorMacro("CheckForCollisions: Beams logic cannot be accessed"); + return "No Beams module"; + } + if (!parameterNode->GetCollisionDetectionEnabled()) { return ""; @@ -1336,13 +1392,13 @@ std::string vtkSlicerRoomsEyeViewModuleLogic::CheckForCollisions(vtkMRMLRoomsEye // Get transforms used in the collision detection filters vtkMRMLLinearTransformNode* gantryToFixedReferenceTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference); + this->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference); vtkMRMLLinearTransformNode* patientSupportToPatientSupportRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupport, vtkSlicerIECTransformLogic::PatientSupportRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupport, vtkIECTransformLogic::PatientSupportRotation); vtkMRMLLinearTransformNode* collimatorToGantryTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry); + this->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry); vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode = - this->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + this->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); if ( !gantryToFixedReferenceTransformNode || !patientSupportToPatientSupportRotationTransformNode || !collimatorToGantryTransformNode || !tableTopToTableTopEccentricRotationTransformNode ) diff --git a/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.h b/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.h index a1678c01b..7d21e0789 100644 --- a/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.h +++ b/RoomsEyeView/Logic/vtkSlicerRoomsEyeViewModuleLogic.h @@ -34,9 +34,10 @@ // Slicer includes #include +#include -// Beams includes -#include "vtkSlicerBeamsModuleLogic.h" +// IEC Logic include +#include class vtkCollisionDetectionFilter; class vtkMatrix4x4; @@ -143,7 +144,7 @@ class VTK_SLICER_ROOMSEYEVIEW_LOGIC_EXPORT vtkSlicerRoomsEyeViewModuleLogic : pu /// Get part type as string const char* GetTreatmentMachinePartTypeAsString(TreatmentMachinePartType type); - vtkGetObjectMacro(IECLogic, vtkSlicerIECTransformLogic); + vtkGetObjectMacro(IECLogic, vtkIECTransformLogic); /// Possibility to set Beams logic externally. This allows automated tests to run, when we do not have the whole application vtkSetObjectMacro(BeamsLogic, vtkSlicerBeamsModuleLogic); @@ -161,7 +162,7 @@ class VTK_SLICER_ROOMSEYEVIEW_LOGIC_EXPORT vtkSlicerRoomsEyeViewModuleLogic : pu /// \return Transform node if there is a direct transform between the specified coordinate frames, nullptr otherwise /// Note: If IEC does not specify a transform between the given coordinate frames, then there will be no node with the returned name. vtkMRMLLinearTransformNode* GetTransformNodeBetween( - vtkSlicerIECTransformLogic::CoordinateSystemIdentifier fromFrame, vtkSlicerIECTransformLogic::CoordinateSystemIdentifier toFrame); + vtkIECTransformLogic::CoordinateSystemIdentifier fromFrame, vtkIECTransformLogic::CoordinateSystemIdentifier toFrame); protected: /// Get patient body closed surface poly data from segmentation node and segment selection in the parameter node @@ -171,7 +172,7 @@ class VTK_SLICER_ROOMSEYEVIEW_LOGIC_EXPORT vtkSlicerRoomsEyeViewModuleLogic : pu vtkSlicerBeamsModuleLogic* GetBeamsLogic(); protected: - vtkSlicerIECTransformLogic* IECLogic; + vtkIECTransformLogic* IECLogic; vtkSlicerBeamsModuleLogic* BeamsLogic{nullptr}; vtkCollisionDetectionFilter* GantryPatientCollisionDetection; diff --git a/RoomsEyeView/Testing/Cxx/vtkSlicerRoomsEyeViewLogicTest1.cxx b/RoomsEyeView/Testing/Cxx/vtkSlicerRoomsEyeViewLogicTest1.cxx index 58a8499ed..0e84f1550 100644 --- a/RoomsEyeView/Testing/Cxx/vtkSlicerRoomsEyeViewLogicTest1.cxx +++ b/RoomsEyeView/Testing/Cxx/vtkSlicerRoomsEyeViewLogicTest1.cxx @@ -25,9 +25,11 @@ // Beams includes #include "vtkMRMLRTBeamNode.h" #include "vtkMRMLRTPlanNode.h" -#include "vtkSlicerIECTransformLogic.h" #include "vtkSlicerBeamsModuleLogic.h" +// IEC Logic include +#include + // MRML includes #include #include @@ -121,7 +123,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedFixedReferenceToRasTransform_Origin_MatrixElements[16] = { -1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS), expectedFixedReferenceToRasTransform_Origin_MatrixElements)) { std::cerr << __LINE__ << ": FixedReferenceToRasTransform transform does not match baseline for origin" << std::endl; @@ -136,7 +138,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedFixedReferenceToRasTransform_Translated_MatrixElements[16] = { -1, 0, 0, 1000, 0, 0, 1, 200, 0, 1, 0, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::FixedReference, vtkSlicerIECTransformLogic::RAS), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::FixedReference, vtkIECTransformLogic::RAS), expectedFixedReferenceToRasTransform_Translated_MatrixElements)) { std::cerr << __LINE__ << ": FixedReferenceToRasTransform transform does not match baseline for translated isocenter" << std::endl; @@ -155,7 +157,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedGantryToFixedReferenceTransformMinus1_MatrixElements[16] = { 0.999848, 0, -0.0174524, 0, 0, 1, 0, 0, 0.0174524, 0, 0.999848, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference), expectedGantryToFixedReferenceTransformMinus1_MatrixElements)) { std::cerr << __LINE__ << ": GantryToFixedReferenceTransform does not match baseline for -1 degree angle" << std::endl; @@ -168,7 +170,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedGantryToFixedReferenceTransform_1_MatrixElements[16] = { 0.999848, 0, 0.0174524, 0, 0, 1, 0, 0, -0.0174524, 0, 0.999848, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference), expectedGantryToFixedReferenceTransform_1_MatrixElements)) { std::cerr << __LINE__ << ": GantryToFixedReferenceTransform does not match baseline for 1 degree angle" << std::endl; @@ -181,7 +183,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedGantryToFixedReference_Minus90_MatrixElements[16] = { 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference), expectedGantryToFixedReference_Minus90_MatrixElements)) { std::cerr << __LINE__ << ": GantryToFixedReferenceTransform does not match baseline for -90 degrees angle" << std::endl; @@ -194,7 +196,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedGantryToFixedReference_90_MatrixElements[16] = { 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Gantry, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Gantry, vtkIECTransformLogic::FixedReference), expectedGantryToFixedReference_90_MatrixElements)) { std::cerr << __LINE__ << ": GantryToFixedReferenceTransform does not match baseline for 90 degrees angle" << std::endl; @@ -214,7 +216,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedCollimatorToGantryTransform_Minus1_MatrixElements[16] = { 0.999848, 0.0174524, 0, 0, -0.0174524, 0.999848, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry), expectedCollimatorToGantryTransform_Minus1_MatrixElements)) { std::cerr << __LINE__ << ": CollimatorToGantry does not match baseline for -1 degree angle" << std::endl; @@ -234,7 +236,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedCollimatorToGantryTransform_1_MatrixElements[16] = { 0.999848, -0.0174524, 0, 0, 0.0174524, 0.999848, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry), expectedCollimatorToGantryTransform_1_MatrixElements)) { std::cerr << __LINE__ << ": CollimatorToGantry does not match baseline for 1 degree angle" << std::endl; @@ -247,7 +249,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedCollimatorToGantryTransform_Minus90_MatrixElements[16] = { 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry), expectedCollimatorToGantryTransform_Minus90_MatrixElements)) { std::cerr << __LINE__ << ": CollimatorToGantry does not match baseline for -90 degree angle" << std::endl; @@ -260,7 +262,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedCollimatorToGantryTransform_90_MatrixElements[16] = { 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::Collimator, vtkSlicerIECTransformLogic::Gantry), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::Collimator, vtkIECTransformLogic::Gantry), expectedCollimatorToGantryTransform_90_MatrixElements)) { std::cerr << __LINE__ << ": CollimatorToGantry does not match baseline for 90 degree angle" << std::endl; @@ -279,7 +281,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedPatientSupportRotationToFixedReferenceTransformMinus1_MatrixElements[16] = { 0.999848, 0.0174524, 0, 0, -0.0174524, 0.999848, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference), expectedPatientSupportRotationToFixedReferenceTransformMinus1_MatrixElements)) { std:cerr << __LINE__ << ": PatientSupportRotationToFixedReference does not match baseline for -1 degree angle" << std::endl; @@ -292,7 +294,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedPatientSupportRotationToFixedReferenceTransform1_MatrixElements[16] = { 0.999848, -0.0174524, 0, 0, 0.0174524, 0.999848, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference), expectedPatientSupportRotationToFixedReferenceTransform1_MatrixElements)) { std::cerr << __LINE__ << ": PatientSupportRotationToFixedReference does not match baseline for 1 degree angle" << std::endl; @@ -305,7 +307,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedPatientSupportRotationToFixedReferenceTransformMinus90_MatrixElements[16] = { 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference), expectedPatientSupportRotationToFixedReferenceTransformMinus90_MatrixElements)) { std::cerr << __LINE__ << ": PatientSupportRotationToFixedReference does not match baseline for -90 degree angle" << std::endl; @@ -318,7 +320,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedPatientSupportRotationToFixedReferenceTransform90_MatrixElements[16] = { 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::PatientSupportRotation, vtkSlicerIECTransformLogic::FixedReference), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::PatientSupportRotation, vtkIECTransformLogic::FixedReference), expectedPatientSupportRotationToFixedReferenceTransform90_MatrixElements)) { std::cerr << __LINE__ << ": PatientSupportRotationToFixedReference does not match baseline for 90 degree angle" << std::endl; @@ -327,7 +329,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (vertical), 1.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Vertical1 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Vertical1 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Vertical1->GetTransformToParent()); @@ -345,7 +347,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Vertical1_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Vertical1_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (vertical) does not match baseline for 1.0mm" << std::endl; @@ -354,7 +356,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (vertical), -1.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Vertical_Minus1 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Vertical_Minus1 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Vertical_Minus1->GetTransformToParent()); @@ -369,7 +371,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Vertical_Minus1_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Vertical_Minus1_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (vertical) does not match baseline for -1.0mm" << std::endl; @@ -379,7 +381,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (vertical), 299.0mm // This is the max value for the default Varian machine in this case vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Vertical_299 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Vertical_299 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Vertical_299->GetTransformToParent()); @@ -394,7 +396,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Vertical_299_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 299, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Vertical_299_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (vertical) does not match baseline for 299.0mm" << std::endl; @@ -404,7 +406,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (vertical), -500.0mm // This is the min value for the default Varian machine in this case vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Vertical_Minus500 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Vertical_Minus500 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Vertical_Minus500->GetTransformToParent()); @@ -419,7 +421,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Vertical_Minus500_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -500, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Vertical_Minus500_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (vertical) does not match baseline for -500.0mm" << std::endl; @@ -428,7 +430,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (longitudinal), 1.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Longitudinal_1 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Longitudinal_1 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Longitudinal_1->GetTransformToParent()); @@ -443,7 +445,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Longitudinal_1_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Longitudinal_1_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (longitudinal) does not match baseline for 1.0mm" << std::endl; @@ -452,7 +454,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (longitudinal), -1.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Longitudinal_Minus1 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Longitudinal_Minus1 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Longitudinal_Minus1->GetTransformToParent()); @@ -467,7 +469,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Longitudinal_Minus1_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Longitudinal_Minus1_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (longitudinal) does not match baseline for -1.0mm" << std::endl; @@ -476,7 +478,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (longitudinal), 90.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Longitudinal_90 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Longitudinal_90 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Longitudinal_90->GetTransformToParent()); @@ -491,7 +493,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Longitudinal_90_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 90, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Longitudinal_90_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (longitudinal) does not match baseline for 90.0mm" << std::endl; @@ -501,7 +503,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (longitudinal), 1000.0mm // This is the max value for the default Varian machine in this case vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Longitudinal_1000 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Longitudinal_1000 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Longitudinal_1000->GetTransformToParent()); @@ -516,7 +518,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Longitudinal_1000_MatrixElements[16] = { 1, 0, 0, 0, 0, 1, 0, 1000, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Longitudinal_1000_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (longitudinal) does not match baseline for 1000.0mm" << std::endl; @@ -525,7 +527,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (lateral), 1.0mm vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Lateral_1 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Lateral_1 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Lateral_1->GetTransformToParent()); @@ -540,7 +542,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Lateral_1_MatrixElements[16] = { 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Lateral_1_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (lateral) does not match baseline for 1.0mm" << std::endl; @@ -550,7 +552,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (lateral), 230.0mm // This is the max value for the default Varian machine in this case vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Lateral_230 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Lateral_230 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Lateral_230->GetTransformToParent()); @@ -565,7 +567,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Lateral_230_MatrixElements[16] = { 1, 0, 0, 230, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Lateral_230_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (lateral) does not match baseline for 230.0mm" << std::endl; @@ -575,7 +577,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) // Table Top (lateral), -230.0mm // This is the min value for the default Varian machine in this case vtkMRMLLinearTransformNode* tableTopToTableTopEccentricRotationTransformNode_Lateral_Minus230 = - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation); + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation); vtkTransform* tableTopEccentricRotationToPatientSupportTransform_Lateral_Minus230 = vtkTransform::SafeDownCast( tableTopToTableTopEccentricRotationTransformNode_Lateral_Minus230->GetTransformToParent()); @@ -590,7 +592,7 @@ int vtkSlicerRoomsEyeViewLogicTest1(int vtkNotUsed(argc), char* vtkNotUsed(argv) double expectedTableTopToTableTop_Lateral_Minus230_MatrixElements[16] = { 1, 0, 0, -230, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; if (!IsTransformMatrixEqualTo(mrmlScene, - revLogic->GetTransformNodeBetween(vtkSlicerIECTransformLogic::TableTop, vtkSlicerIECTransformLogic::TableTopEccentricRotation), + revLogic->GetTransformNodeBetween(vtkIECTransformLogic::TableTop, vtkIECTransformLogic::TableTopEccentricRotation), expectedTableTopToTableTop_Lateral_Minus230_MatrixElements)) { std::cerr << __LINE__ << ": PatientToTableTopTransform (lateral) does not match baseline for -230.0mm" << std::endl; diff --git a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx index 5bae025ae..577e0e704 100644 --- a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx +++ b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx @@ -30,7 +30,7 @@ #include "vtkMRMLRoomsEyeViewNode.h" // Beams includes -#include "vtkSlicerIECTransformLogic.h" +#include "vtkIECTransformLogic.h" #include "vtkMRMLRTBeamNode.h" #include "vtkMRMLRTPlanNode.h" @@ -1055,8 +1055,8 @@ void qSlicerRoomsEyeViewModuleWidget::onFixedReferenceCameraToggled(bool toggled // Get FixedReference -> RAS transform node vtkMRMLLinearTransformNode* fixedReferenceToRasTransformNode = d->logic()->GetTransformNodeBetween( - vtkSlicerIECTransformLogic::FixedReference, - vtkSlicerIECTransformLogic::RAS); + vtkIECTransformLogic::FixedReference, + vtkIECTransformLogic::RAS); vtkNew fixedReferenceToRasTransformMatrix; fixedReferenceToRasTransformMatrix->Identity(); diff --git a/SuperBuild.cmake b/SuperBuild.cmake index 11511e286..997b520a3 100644 --- a/SuperBuild.cmake +++ b/SuperBuild.cmake @@ -19,6 +19,7 @@ set(proj ${SUPERBUILD_TOPLEVEL_PROJECT}) # Project dependencies set(${proj}_DEPENDS Plastimatch + vtkIECTransformLogic ) ExternalProject_Include_Dependencies(${proj} diff --git a/SuperBuild/External_vtkIECTransformLogic.cmake b/SuperBuild/External_vtkIECTransformLogic.cmake new file mode 100644 index 000000000..de7dbe37f --- /dev/null +++ b/SuperBuild/External_vtkIECTransformLogic.cmake @@ -0,0 +1,73 @@ + +set(proj vtkIECTransformLogic) + +# Set dependency list +set(${proj}_DEPENDS "") +if(DEFINED Slicer_SOURCE_DIR) + list(APPEND ${proj}_DEPENDS + VTK + ) +endif() + +# Include dependent projects if any +ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj) + +if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) + message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !") +endif() + + +if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) + + set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + + + #message("Slicer_THIRDPARTY_LIB_DIR ZZZZZZZZ: ${Slicer_THIRDPARTY_LIB_DIR}") + + ExternalProject_Add(${proj} + ${${proj}_EP_ARGS} + GIT_REPOSITORY https://github.com/EBATINCA/RadiotherapyTransformsIEC.git + GIT_TAG origin/main + SOURCE_DIR ${EP_SOURCE_DIR} + BINARY_DIR ${EP_BINARY_DIR} + CMAKE_CACHE_ARGS + # Compiler settings + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} + -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED} + -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS} + # Output directories + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${EP_BINARY_DIR} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${EP_BINARY_DIR} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${EP_BINARY_DIR} + # Install directories + # NA + -DVTK_DIR:STRING=${VTK_DIR} + # Options + -DBUILD_SHARED_LIBS:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -DPLM_CONFIG_ENABLE_CUDA:BOOL=OFF + -DPLM_CONFIG_LIBRARY_BUILD:BOOL=ON + -DPLM_CONFIG_INSTALL_LIBRARIES:BOOL=ON + -DPLM_PREFER_SYSTEM_DLIB:BOOL=OFF + -DPLMLIB_CONFIG_ENABLE_REGISTER:BOOL=TRUE + -DPLMLIB_CONFIG_ENABLE_RECONSTRUCT:BOOL=TRUE + -DPLMLIB_CONFIG_ENABLE_DOSE:BOOL=TRUE + INSTALL_COMMAND "" + DEPENDS + ${${proj}_DEPENDS} + ) + set(${proj}_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${proj}/src;${CMAKE_BINARY_DIR}/${proj}-build/Debug) + set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + +else() + ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDS}) +endif() + +#mark_as_superbuild(${proj}_INCLUDE_DIRS:PATH) +mark_as_superbuild(${proj}_DIR:PATH) +mark_as_superbuild(${proj}_INCLUDE_DIRS:PATH)