# HG changeset patch # User Sebastien Jodogne # Date 1651310781 -7200 # Node ID 12e36b1b84f3c9f7cbeb7d8d873dee9eecfb2a82 # Parent 8eb050609cb033e83f791cbe1a1d0055ee6a8434 testing with dcmtk diff -r 8eb050609cb0 -r 12e36b1b84f3 CMakeLists.txt --- a/CMakeLists.txt Tue Apr 26 12:05:13 2022 +0200 +++ b/CMakeLists.txt Sat Apr 30 11:26:21 2022 +0200 @@ -76,9 +76,17 @@ set(ENABLE_GOOGLE_TEST ON) set(ENABLE_ZLIB ON) - set(ENABLE_DCMTK OFF) # Could be set to "ON" for debugging - set(ENABLE_PNG OFF) # Could be set to "ON" for debugging - set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost) + if (OFF) + # Enable DCMTK for testing on raw DICOM files + set(ENABLE_DCMTK ON) + set(ENABLE_PNG ON) + set(ENABLE_LOCALE ON) + else() + set(ENABLE_DCMTK OFF) + set(ENABLE_PNG OFF) + set(ENABLE_LOCALE OFF) + endif() + set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "") include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) @@ -147,6 +155,11 @@ ${ORTHANC_CORE_SOURCES} ) +if (ENABLE_DCMTK) + link_libraries(${DCMTK_LIBRARIES}) + list(APPEND NEURO_SOURCES ${ORTHANC_DICOM_SOURCES}) +endif() + add_custom_target( AutogeneratedTarget diff -r 8eb050609cb0 -r 12e36b1b84f3 Sources/UnitTestsSources/UnitTestsMain.cpp --- a/Sources/UnitTestsSources/UnitTestsMain.cpp Tue Apr 26 12:05:13 2022 +0200 +++ b/Sources/UnitTestsSources/UnitTestsMain.cpp Sat Apr 30 11:26:21 2022 +0200 @@ -22,6 +22,39 @@ #include +#if ORTHANC_ENABLE_DCMTK == 1 +# include "../Framework/InputDicomInstance.h" +# include +# include + +TEST(Dcmtk, DumpCSAHeader) +{ + std::string s; + Orthanc::SystemToolbox::ReadFile(s, "49210406"); + + Orthanc::ParsedDicomFile dicom(s); + + Neuro::InputDicomInstance instance(dicom); + + std::list tags; + instance.GetCSAHeader().ListTags(tags); + + for (std::list::const_iterator it = tags.begin(); it != tags.end(); ++it) + { + const Neuro::CSATag& tag = instance.GetCSAHeader().GetTag(*it); + + printf("[%s] (%d) = ", it->c_str(), tag.GetSize()); + for (size_t i = 0; i < tag.GetSize(); i++) + { + printf("[%s] ", tag.GetStringValue(i).c_str()); + } + + printf("\n"); + } +} +#endif + + int main(int argc, char **argv) { Orthanc::Logging::Initialize();