From c720671558cb7bd18207a7ea6db3b46a9c2addf4 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Tue, 16 Aug 2022 16:41:37 +0200 Subject: [PATCH 1/4] ENH: Account for yaw rotation in ImagingRing geometry --- src/rtkOraGeometryReader.cxx | 21 +++++++++++++++++++++ src/rtkOraXMLFileReader.cxx | 1 + 2 files changed, 22 insertions(+) diff --git a/src/rtkOraGeometryReader.cxx b/src/rtkOraGeometryReader.cxx index 0a6a0a93b..ceb221daf 100644 --- a/src/rtkOraGeometryReader.cxx +++ b/src/rtkOraGeometryReader.cxx @@ -127,6 +127,27 @@ OraGeometryReader::GenerateData() v = tiltTransform->TransformVector(v); } + // Ring yaw (only available in some versions) + MetaDataDoubleType * yawMeta = dynamic_cast(dic["room_cs_yaw_deg"].GetPointer()); + if (yawMeta != nullptr) + { + double yaw = yawMeta->GetMetaDataObjectValue(); + auto tiltTransform = itk::VersorRigid3DTransform::New(); + const double deg2rad = std::atan(1.0) / 45.0; + tiltTransform->SetRotation(itk::MakeVector(0., 0., 1.), yaw * deg2rad); + + // Set center of rotation + MetaDataDoubleType * yvecMeta = + dynamic_cast(dic["ydistancebaseunitcs2imagingcs_cm"].GetPointer()); + double yvec = yvecMeta->GetMetaDataObjectValue(); + tiltTransform->SetCenter(itk::MakePoint(0., -10. * yvec, 0.)); + + sp = tiltTransform->TransformPoint(sp); + dp = tiltTransform->TransformPoint(dp); + u = tiltTransform->TransformVector(u); + v = tiltTransform->TransformVector(v); + } + // Got it, add to geometry m_Geometry->AddProjection(sp, dp, u, v); diff --git a/src/rtkOraXMLFileReader.cxx b/src/rtkOraXMLFileReader.cxx index 6dbb0e92d..4c8a08f87 100644 --- a/src/rtkOraXMLFileReader.cxx +++ b/src/rtkOraXMLFileReader.cxx @@ -60,6 +60,7 @@ OraXMLFileReader ::EndElement(const char * name) EncapsulateDouble("xrayy2_cm", name); EncapsulateDouble("tiltleft_deg", name); EncapsulateDouble("tiltright_deg", name); + EncapsulateDouble("room_cs_yaw_deg", name); EncapsulateDouble("ydistancebaseunitcs2imagingcs_cm", name); EncapsulateDouble("zdistancebaseunitcs2imagingcs_cm", name); } From ab572956d370ba7187fe7e24d949a85af94e34b7 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 17 Aug 2022 07:48:30 +0200 Subject: [PATCH 2/4] ENH: Add OptiTrack option to Ora geometry --- .../rtkorageometry/rtkorageometry.cxx | 1 + .../rtkorageometry/rtkorageometry.ggo | 1 + include/rtkOraGeometryReader.h | 6 ++ include/rtkOraXMLFileReader.h | 3 + src/rtkOraGeometryReader.cxx | 82 ++++++++++++++++++- src/rtkOraXMLFileReader.cxx | 41 ++++++++-- 6 files changed, 123 insertions(+), 11 deletions(-) diff --git a/applications/rtkorageometry/rtkorageometry.cxx b/applications/rtkorageometry/rtkorageometry.cxx index 6a68b4a4f..fefd26ee5 100644 --- a/applications/rtkorageometry/rtkorageometry.cxx +++ b/applications/rtkorageometry/rtkorageometry.cxx @@ -35,6 +35,7 @@ main(int argc, char * argv[]) rtk::OraGeometryReader::Pointer oraReader = rtk::OraGeometryReader::New(); oraReader->SetProjectionsFileNames(rtk::GetProjectionsFileNamesFromGgo(args_info)); oraReader->SetCollimationMargin(margin); + oraReader->SetOptiTrackObjectID(args_info.optitrack_arg); TRY_AND_EXIT_ON_ITK_EXCEPTION(oraReader->UpdateOutputData()) // Write diff --git a/applications/rtkorageometry/rtkorageometry.ggo b/applications/rtkorageometry/rtkorageometry.ggo index 76f3f741f..b2ad9cfa6 100644 --- a/applications/rtkorageometry/rtkorageometry.ggo +++ b/applications/rtkorageometry/rtkorageometry.ggo @@ -5,6 +5,7 @@ option "verbose" v "Verbose execution" flag off option "config" - "Config file" string no option "output" o "Output file name" string yes option "margin" m "Collimation margin (uinf, usup, vinf, vsup)" double no multiple default="0." +option "optitrack" - "OptiTrack object ID (unused by default)" int no default="-1" section "Projections" option "path" p "Path containing projections" string yes diff --git a/include/rtkOraGeometryReader.h b/include/rtkOraGeometryReader.h index ffb1cd690..78ecab02b 100644 --- a/include/rtkOraGeometryReader.h +++ b/include/rtkOraGeometryReader.h @@ -89,6 +89,11 @@ class RTK_EXPORT OraGeometryReader : public itk::LightProcessObject itkGetMacro(CollimationMargin, MarginVectorType); itkSetMacro(CollimationMargin, MarginVectorType); + /** Selected OptiTrack object ID. Default is -1, i.e., do not use the + * OptiTrack object ID. * */ + itkGetMacro(OptiTrackObjectID, int); + itkSetMacro(OptiTrackObjectID, int); + protected: OraGeometryReader() @@ -104,6 +109,7 @@ class RTK_EXPORT OraGeometryReader : public itk::LightProcessObject GeometryType::Pointer m_Geometry; FileNamesContainer m_ProjectionsFileNames; MarginVectorType m_CollimationMargin; + int m_OptiTrackObjectID{ -1 }; }; } // namespace rtk diff --git a/include/rtkOraXMLFileReader.h b/include/rtkOraXMLFileReader.h index b3938cd58..b720d832f 100644 --- a/include/rtkOraXMLFileReader.h +++ b/include/rtkOraXMLFileReader.h @@ -76,6 +76,9 @@ class RTK_EXPORT OraXMLFileReader : public itk::XMLReader + void + EncapsulateVector(const char * metaName, const char * name); void EncapsulateString(const char * metaName, const char * name); diff --git a/src/rtkOraGeometryReader.cxx b/src/rtkOraGeometryReader.cxx index ceb221daf..f635fdb4d 100644 --- a/src/rtkOraGeometryReader.cxx +++ b/src/rtkOraGeometryReader.cxx @@ -27,6 +27,7 @@ #include #include #include +#include namespace rtk { @@ -37,6 +38,8 @@ OraGeometryReader::GenerateData() { m_Geometry = GeometryType::New(); RegisterIOFactories(); + itk::QuaternionRigidTransform::Pointer firstQuaternionsX{ nullptr }; + itk::Vector firstTranslation; for (const std::string & projectionsFileName : m_ProjectionsFileNames) { itk::ImageIOBase::Pointer reader; @@ -54,6 +57,8 @@ OraGeometryReader::GenerateData() using MetaDataVectorType = itk::MetaDataObject; using MetaDataMatrixType = itk::MetaDataObject; using MetaDataDoubleType = itk::MetaDataObject; + using MetaDataVectorDoubleType = itk::MetaDataObject>; + using MetaDataVectorIntType = itk::MetaDataObject>; // Source position MetaDataVectorType * spMeta = dynamic_cast(dic["SourcePosition"].GetPointer()); @@ -103,7 +108,7 @@ OraGeometryReader::GenerateData() // Ring tilt (only available in some versions) MetaDataDoubleType * tiltLeftMeta = dynamic_cast(dic["tiltleft_deg"].GetPointer()); - if (tiltLeftMeta != nullptr) + if (tiltLeftMeta != nullptr && m_OptiTrackObjectID < 0) { double tiltLeft = tiltLeftMeta->GetMetaDataObjectValue(); MetaDataDoubleType * tiltRightMeta = dynamic_cast(dic["tiltright_deg"].GetPointer()); @@ -129,7 +134,7 @@ OraGeometryReader::GenerateData() // Ring yaw (only available in some versions) MetaDataDoubleType * yawMeta = dynamic_cast(dic["room_cs_yaw_deg"].GetPointer()); - if (yawMeta != nullptr) + if (yawMeta != nullptr && m_OptiTrackObjectID < 0) { double yaw = yawMeta->GetMetaDataObjectValue(); auto tiltTransform = itk::VersorRigid3DTransform::New(); @@ -148,6 +153,79 @@ OraGeometryReader::GenerateData() v = tiltTransform->TransformVector(v); } + // OptiTrack objects (objects tracked with infrared cameras) + if (m_OptiTrackObjectID >= 0) + { + // Find ID index of the OptiTrack object + MetaDataVectorIntType * idsMeta = dynamic_cast(dic["optitrack_object_ids"].GetPointer()); + if (idsMeta == nullptr) + itkExceptionMacro("Could not find optitrack_object_ids in " << projectionsFileName); + const std::vector ids = idsMeta->GetMetaDataObjectValue(); + auto idIt = std::find(ids.begin(), ids.end(), m_OptiTrackObjectID); + int idIdx = idIt - ids.begin(); + + // Translation + MetaDataVectorDoubleType * posMeta = + dynamic_cast(dic["optitrack_positions"].GetPointer()); + if (posMeta == nullptr) + itkExceptionMacro("Could not find optitrack_positions in " << projectionsFileName); + const std::vector p = posMeta->GetMetaDataObjectValue(); + if (p.size() < 3 * (idIdx + 1)) + itkExceptionMacro("Not enough values in optitrack_positions of " << projectionsFileName); + itk::Vector translation = 10. * itk::MakeVector(p[idIdx * 3], p[idIdx * 3 + 1], p[idIdx * 3 + 2]); + + // Rotation + MetaDataVectorDoubleType * rotMeta = + dynamic_cast(dic["optitrack_rotations"].GetPointer()); + if (rotMeta == nullptr) + itkExceptionMacro("Could not find optitrack_rotations in " << projectionsFileName); + const std::vector optitrackRotations = rotMeta->GetMetaDataObjectValue(); + if (optitrackRotations.size() < 4 * (idIdx + 1)) + itkExceptionMacro("Not enough values in optitrack_rotations of " << projectionsFileName); + auto quaternionsX = itk::QuaternionRigidTransform::New(); + itk::QuaternionRigidTransform::ParametersType quaternionsXParam(7); + quaternionsXParam[3] = optitrackRotations[idIdx * 4]; + quaternionsXParam[0] = optitrackRotations[idIdx * 4 + 1]; + quaternionsXParam[1] = optitrackRotations[idIdx * 4 + 2]; + quaternionsXParam[2] = optitrackRotations[idIdx * 4 + 3]; + quaternionsXParam[4] = 0.; + quaternionsXParam[5] = 0.; + quaternionsXParam[6] = 0.; + quaternionsX->SetParameters(quaternionsXParam); + + // Set center of rotation + MetaDataDoubleType * yvecMeta = + dynamic_cast(dic["ydistancebaseunitcs2imagingcs_cm"].GetPointer()); + double yvec = yvecMeta->GetMetaDataObjectValue(); + MetaDataDoubleType * zvecMeta = + dynamic_cast(dic["zdistancebaseunitcs2imagingcs_cm"].GetPointer()); + double zvec = zvecMeta->GetMetaDataObjectValue(); + if (firstQuaternionsX.GetPointer() == nullptr) + { + firstQuaternionsX = quaternionsX; + firstTranslation = translation; + } + else + { + itk::MatrixOffsetTransformBase::InverseTransformBasePointer invQuaternionsX = + quaternionsX->GetInverseTransform(); + + sp = sp - translation; + dp = dp - translation; + sp = invQuaternionsX->TransformPoint(sp); + dp = invQuaternionsX->TransformPoint(dp); + u = invQuaternionsX->TransformVector(u); + v = invQuaternionsX->TransformVector(v); + + sp = firstQuaternionsX->TransformPoint(sp); + dp = firstQuaternionsX->TransformPoint(dp); + u = firstQuaternionsX->TransformVector(u); + v = firstQuaternionsX->TransformVector(v); + sp = sp + firstTranslation; + dp = dp + firstTranslation; + } + } + // Got it, add to geometry m_Geometry->AddProjection(sp, dp, u, v); diff --git a/src/rtkOraXMLFileReader.cxx b/src/rtkOraXMLFileReader.cxx index 4c8a08f87..c36c3a9cd 100644 --- a/src/rtkOraXMLFileReader.cxx +++ b/src/rtkOraXMLFileReader.cxx @@ -23,13 +23,13 @@ namespace rtk { -OraXMLFileReader ::OraXMLFileReader() +OraXMLFileReader::OraXMLFileReader() { m_OutputObject = &m_Dictionary; } int -OraXMLFileReader ::CanReadFile(const char * name) +OraXMLFileReader::CanReadFile(const char * name) { if (!itksys::SystemTools::FileExists(name) || itksys::SystemTools::FileIsDirectory(name) || itksys::SystemTools::FileLength(name) == 0) @@ -38,13 +38,13 @@ OraXMLFileReader ::CanReadFile(const char * name) } void -OraXMLFileReader ::StartElement(const char * itkNotUsed(name), const char ** itkNotUsed(atts)) +OraXMLFileReader::StartElement(const char * itkNotUsed(name), const char ** itkNotUsed(atts)) { m_CurCharacterData = ""; } void -OraXMLFileReader ::EndElement(const char * name) +OraXMLFileReader::EndElement(const char * name) { EncapsulatePoint("SourcePosition", name); EncapsulatePoint("Origin", name); @@ -63,17 +63,20 @@ OraXMLFileReader ::EndElement(const char * name) EncapsulateDouble("room_cs_yaw_deg", name); EncapsulateDouble("ydistancebaseunitcs2imagingcs_cm", name); EncapsulateDouble("zdistancebaseunitcs2imagingcs_cm", name); + EncapsulateVector("optitrack_object_ids", name); + EncapsulateVector("optitrack_positions", name); + EncapsulateVector("optitrack_rotations", name); } void -OraXMLFileReader ::CharacterDataHandler(const char * inData, int inLength) +OraXMLFileReader::CharacterDataHandler(const char * inData, int inLength) { for (int i = 0; i < inLength; i++) m_CurCharacterData = m_CurCharacterData + inData[i]; } void -OraXMLFileReader ::EncapsulatePoint(const char * metaName, const char * name) +OraXMLFileReader::EncapsulatePoint(const char * metaName, const char * name) { if (itksys::SystemTools::Strucmp(name, metaName) == 0) { @@ -90,7 +93,7 @@ OraXMLFileReader ::EncapsulatePoint(const char * metaName, const char * name) } void -OraXMLFileReader ::EncapsulateMatrix3x3(const char * metaName, const char * name) +OraXMLFileReader::EncapsulateMatrix3x3(const char * metaName, const char * name) { if (itksys::SystemTools::Strucmp(name, metaName) == 0) { @@ -110,7 +113,7 @@ OraXMLFileReader ::EncapsulateMatrix3x3(const char * metaName, const char * name } void -OraXMLFileReader ::EncapsulateDouble(const char * metaName, const char * name) +OraXMLFileReader::EncapsulateDouble(const char * metaName, const char * name) { if (itksys::SystemTools::Strucmp(name, metaName) == 0) { @@ -119,8 +122,28 @@ OraXMLFileReader ::EncapsulateDouble(const char * metaName, const char * name) } } +template void -OraXMLFileReader ::EncapsulateString(const char * metaName, const char * name) +OraXMLFileReader::EncapsulateVector(const char * metaName, const char * name) +{ + if (itksys::SystemTools::Strucmp(name, metaName) == 0) + { + std::vector v; + std::istringstream iss(m_CurCharacterData); + TValue d; + iss >> d; + while (!iss.fail()) + { + v.push_back(d); + iss.ignore(1); + iss >> d; + } + itk::EncapsulateMetaData>(m_Dictionary, metaName, v); + } +} + +void +OraXMLFileReader::EncapsulateString(const char * metaName, const char * name) { if (itksys::SystemTools::Strucmp(name, metaName) == 0) { From 369824716bc1004204610fba0844bc862a52f664 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 24 Aug 2022 00:37:03 +0200 Subject: [PATCH 3/4] ENH: Add warning when Ora projection is not valid --- src/rtkOraGeometryReader.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rtkOraGeometryReader.cxx b/src/rtkOraGeometryReader.cxx index f635fdb4d..29881ca11 100644 --- a/src/rtkOraGeometryReader.cxx +++ b/src/rtkOraGeometryReader.cxx @@ -227,7 +227,11 @@ OraGeometryReader::GenerateData() } // Got it, add to geometry - m_Geometry->AddProjection(sp, dp, u, v); + if (!m_Geometry->AddProjection(sp, dp, u, v)) + { + itkWarningMacro("Could not add " << projectionsFileName << " with sp=" << sp << ", dp=" << dp << ", u=" << u + << " and v=" << v); + } // Now add the collimation // longitudinalposition_cm From 40a2fc6124bc356663966fc0f39ccfafb38fdfe2 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 14 Dec 2022 14:49:57 +0100 Subject: [PATCH 4/4] ENH: Add tests for yaw and optitrack information in ImagingRing files --- .../Ora/geometry_optitrack.xml.sha512 | 1 + test/Baseline/Ora/geometry_tilt.xml.sha512 | 1 - test/Baseline/Ora/geometry_yawtilt.xml.sha512 | 1 + test/CMakeLists.txt | 5 ++- .../Ora/2006137_20220918183246810.mhd.sha512 | 1 + .../2006137_20220918183246810.ora.xml.sha512 | 1 + test/rtkoratest.cxx | 41 ++++++++++++++----- 7 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 test/Baseline/Ora/geometry_optitrack.xml.sha512 delete mode 100644 test/Baseline/Ora/geometry_tilt.xml.sha512 create mode 100644 test/Baseline/Ora/geometry_yawtilt.xml.sha512 create mode 100644 test/Input/Ora/2006137_20220918183246810.mhd.sha512 create mode 100644 test/Input/Ora/2006137_20220918183246810.ora.xml.sha512 diff --git a/test/Baseline/Ora/geometry_optitrack.xml.sha512 b/test/Baseline/Ora/geometry_optitrack.xml.sha512 new file mode 100644 index 000000000..f676c2067 --- /dev/null +++ b/test/Baseline/Ora/geometry_optitrack.xml.sha512 @@ -0,0 +1 @@ +5bab8df7a936505c56a94881b266791e65d4c4fde6a3ea96043efdb7f8a2a37ecb482d1b7158e843be2d0ee16878df4a3c6c97e7f61369b29334d86422b4f06c diff --git a/test/Baseline/Ora/geometry_tilt.xml.sha512 b/test/Baseline/Ora/geometry_tilt.xml.sha512 deleted file mode 100644 index d1d634abd..000000000 --- a/test/Baseline/Ora/geometry_tilt.xml.sha512 +++ /dev/null @@ -1 +0,0 @@ -f61bfc309a5ad0ed87eef758d8638821eac1464afe18eedbb8766b72c37ca90ac1d5768bc00537d765945c938100e8962774cce7018fa6576a551ab330ba0b97 diff --git a/test/Baseline/Ora/geometry_yawtilt.xml.sha512 b/test/Baseline/Ora/geometry_yawtilt.xml.sha512 new file mode 100644 index 000000000..5d10b25ec --- /dev/null +++ b/test/Baseline/Ora/geometry_yawtilt.xml.sha512 @@ -0,0 +1 @@ +9f56034b740d0765a507ee3a0d8dc7467cb569f35f80d737b11077d5ffd0f426b3e8d079e73658e19d278890a89ab746a6b85fdb7c86a035fbfce863947e2bbd diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3f68dff8e..d0a1a8b1a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -290,8 +290,9 @@ rtk_add_test(rtkParallelGeometryFromMatrixTest rtkparallelgeometryfrommatrixtest rtk_add_test(rtkOraTest rtkoratest.cxx DATA{Input/Ora/0_afterLog.ora.xml,0_afterLog.mhd,0_afterLog.raw} DATA{Baseline/Ora/geometry.xml} - DATA{Input/Ora/084183_20211217170607335.ora.xml,084183_20211217170607335.mhd} - DATA{Baseline/Ora/geometry_tilt.xml} + DATA{Input/Ora/2006137_20220918183246810.ora.xml,2006137_20220918183246810.mhd} + DATA{Baseline/Ora/geometry_yawtilt.xml} + DATA{Baseline/Ora/geometry_optitrack.xml} DATA{Baseline/Ora/attenuation.mha}) rtk_add_test(rtkBioscanTest rtkbioscantest.cxx diff --git a/test/Input/Ora/2006137_20220918183246810.mhd.sha512 b/test/Input/Ora/2006137_20220918183246810.mhd.sha512 new file mode 100644 index 000000000..cb7f263d7 --- /dev/null +++ b/test/Input/Ora/2006137_20220918183246810.mhd.sha512 @@ -0,0 +1 @@ +7dbe56d87d6026dfa9c350fe2f1f6e9558697044e5acf90c6dcb2a31eb106bb3b24a6a5ae39a32aa9ebe4532af4ec8e5b26cc7f3ad49c56e0eba289a2d39d6c8 diff --git a/test/Input/Ora/2006137_20220918183246810.ora.xml.sha512 b/test/Input/Ora/2006137_20220918183246810.ora.xml.sha512 new file mode 100644 index 000000000..eb9c8cfa1 --- /dev/null +++ b/test/Input/Ora/2006137_20220918183246810.ora.xml.sha512 @@ -0,0 +1 @@ +20f97eb60e40586308bf576e4873e9d534aedbf7148151d2babb30a1556db61c76ba5c0c5c0fa29bb7c8bd93ad94761ddfe7cee7565006ed2fae15d6add2f4d3 diff --git a/test/rtkoratest.cxx b/test/rtkoratest.cxx index bff79dd9b..c17f07dc3 100644 --- a/test/rtkoratest.cxx +++ b/test/rtkoratest.cxx @@ -24,7 +24,9 @@ main(int argc, char * argv[]) { std::cerr << "Usage: " << std::endl; std::cerr << argv[0] << "oraGeometry.xml refGeometry.xml" - << " oraGeometry_tilt.xml refGeometry_tilt.xml" + << " oraGeometry_yawtilt.xml refGeometry_yawtilt.xml" + << " oraGeometry_yaw.xml refGeometry_yaw.xml" + << " refGeometry_optitrack.xml" << " reference.mha" << std::endl; return EXIT_FAILURE; } @@ -48,15 +50,15 @@ main(int argc, char * argv[]) // Check geometries CheckGeometries(geoTargReader->GetGeometry(), geoRefReader->GetOutputObject()); - std::cout << "Testing geometry with tilt..." << std::endl; + std::cout << "Testing geometry with tilt and yaw..." << std::endl; // Ora geometry - std::vector filenames_tilt; - filenames_tilt.emplace_back(argv[3]); - rtk::OraGeometryReader::Pointer geoTargReader_tilt; - geoTargReader_tilt = rtk::OraGeometryReader::New(); - geoTargReader_tilt->SetProjectionsFileNames(filenames_tilt); - TRY_AND_EXIT_ON_ITK_EXCEPTION(geoTargReader_tilt->UpdateOutputData()); + std::vector filenames_yawtilt; + filenames_yawtilt.emplace_back(argv[3]); + rtk::OraGeometryReader::Pointer geoTargReader_yawtilt; + geoTargReader_yawtilt = rtk::OraGeometryReader::New(); + geoTargReader_yawtilt->SetProjectionsFileNames(filenames_yawtilt); + TRY_AND_EXIT_ON_ITK_EXCEPTION(geoTargReader_yawtilt->UpdateOutputData()); // Reference geometry geoRefReader = rtk::ThreeDCircularProjectionGeometryXMLFileReader::New(); @@ -64,7 +66,26 @@ main(int argc, char * argv[]) TRY_AND_EXIT_ON_ITK_EXCEPTION(geoRefReader->GenerateOutputInformation()) // Check geometries - CheckGeometries(geoTargReader_tilt->GetGeometry(), geoRefReader->GetOutputObject()); + CheckGeometries(geoTargReader_yawtilt->GetGeometry(), geoRefReader->GetOutputObject()); + + std::cout << "Testing geometry with optitrack..." << std::endl; + + // Ora geometry + std::vector filenames_opti; + filenames_opti.emplace_back(argv[3]); + rtk::OraGeometryReader::Pointer geoTargReader_opti; + geoTargReader_opti = rtk::OraGeometryReader::New(); + geoTargReader_opti->SetProjectionsFileNames(filenames_opti); + geoTargReader_opti->SetOptiTrackObjectID(2); + TRY_AND_EXIT_ON_ITK_EXCEPTION(geoTargReader_opti->UpdateOutputData()); + + // Reference geometry + geoRefReader = rtk::ThreeDCircularProjectionGeometryXMLFileReader::New(); + geoRefReader->SetFilename(argv[5]); + TRY_AND_EXIT_ON_ITK_EXCEPTION(geoRefReader->GenerateOutputInformation()) + + // Check geometries + CheckGeometries(geoTargReader_opti->GetGeometry(), geoRefReader->GetOutputObject()); // ******* COMPARING projections ******* std::cout << "Testing attenuation conversion..." << std::endl; @@ -98,7 +119,7 @@ main(int argc, char * argv[]) // Reference projections reader ReaderType::Pointer readerRef = ReaderType::New(); filenames.clear(); - filenames.emplace_back(argv[5]); + filenames.emplace_back(argv[6]); readerRef->SetFileNames(filenames); TRY_AND_EXIT_ON_ITK_EXCEPTION(readerRef->Update());