Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/presets/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "common",
"displayName": "Modules GHA",
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES" : "python;qt;graphviz;openmesh;nanovg;vtk;ttk;ezc3d",
"VCPKG_MANIFEST_FEATURES" : "python;qt;graphviz;openmesh;nanovg;vtk;ttk;ezc3d;dicom",
"VCPKG_INSTALL_OPTIONS": "--clean-after-build;--x-abi-tools-use-exact-versions",

"CMAKE_CXX_SCAN_FOR_MODULES": "OFF",
Expand Down
2 changes: 1 addition & 1 deletion .github/presets/linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"IVW_TEST_UNIT_TESTS": { "type": "BOOL", "value": "OFF"},

"$comment": "The vcpkg graphvis package file in static mode",
"VCPKG_MANIFEST_FEATURES" : "python;qt;openmesh;nanovg;vtk;ttk;ezc3d",
"VCPKG_MANIFEST_FEATURES" : "python;qt;openmesh;nanovg;vtk;ttk;ezc3d;dicom",
"IVW_MODULE_GRAPHVIZ": { "type": "BOOL", "value": "OFF"},
"IVW_MODULE_PYTHONTOOLS": { "type": "BOOL", "value": "OFF"}
}
Expand Down
2 changes: 1 addition & 1 deletion .github/presets/macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"IVW_TEST_UNIT_TESTS": { "type": "BOOL", "value": "OFF"},

"$comment1": "The vcpkg graphvis package file in static mode",
"VCPKG_MANIFEST_FEATURES" : "python;qt;openmesh;nanovg;vtk;ttk;ezc3d",
"VCPKG_MANIFEST_FEATURES" : "python;qt;openmesh;nanovg;vtk;ttk;ezc3d;dicom",
"IVW_MODULE_GRAPHVIZ": { "type": "BOOL", "value": "OFF"},

"$comment2": " Assimp and nanovg both implement stb_image in their static libs causing linker issues",
Expand Down
4 changes: 2 additions & 2 deletions .github/presets/windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IVW_CFG_USE_CCACHE_MSVC": "ON",
"IVW_MODULE_SGCT": "ON",
"IVW_APP_INVIWO_DOME": "ON",
"VCPKG_MANIFEST_FEATURES": "python;qt;sgct;graphviz;openmesh;nanovg;vtk;ttk;ezc3d"
"VCPKG_MANIFEST_FEATURES": "python;qt;sgct;graphviz;openmesh;nanovg;vtk;ttk;ezc3d;dicom"
}
},
{
Expand All @@ -27,7 +27,7 @@
"IVW_TEST_UNIT_TESTS": { "type": "BOOL", "value": "OFF"},

"$comment1": "The vcpkg graphvis package file in static mode",
"VCPKG_MANIFEST_FEATURES" : "python;qt;sgct;openmesh;nanovg;vtk;ttk;ezc3d",
"VCPKG_MANIFEST_FEATURES" : "python;qt;sgct;openmesh;nanovg;vtk;ttk;ezc3d;dicom",
"IVW_MODULE_GRAPHVIZ": { "type": "BOOL", "value": "OFF"},

"$comment": "Linker issues with STB being defined in both nanovgutils and sgct",
Expand Down
6 changes: 3 additions & 3 deletions medvis/dicom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ivw_group("Source Files" ${SOURCE_FILES})
ivw_create_module(${SOURCE_FILES} ${HEADER_FILES})

find_package(TIFF REQUIRED)
find_package(gdcm CONFIG REQUIRED)
find_package(GDCM CONFIG REQUIRED)

target_link_libraries(inviwo-module-dicom
PUBLIC
Expand All @@ -48,8 +48,8 @@ target_link_libraries(inviwo-module-dicom
PRIVATE
TIFF::TIFF
)
target_include_directories(inviwo-module-dicom PUBLIC gdcm)
ivw_vcpkg_install(gdcm MODULE DICOM)
target_include_directories(inviwo-module-dicom PUBLIC GDCM)
ivw_vcpkg_install(GDCM MODULE DICOM)

#--------------------------------------------------------------------
ivw_make_package(InviwoDICOMModule inviwo-module-dicom)
1 change: 1 addition & 0 deletions medvis/dicom/depends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Dependencies for current module
set(dependencies
)
set(EnableByDefault ON)
38 changes: 17 additions & 21 deletions medvis/dicom/src/datastructures/dicomdirtypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,19 @@ void Series::updateImageInformation(const std::filesystem::path& dicompath) {
auto sanityCheck = [&](const ImageMetaData& ref, const ImageMetaData& img) {
if (ref.dims != img.dims) {
throw DataReaderException(
fmt::format(
"image sizes differ in DICOM series '{}', expected {} but found {} ('{}')",
desc, toString(ref.dims), toString(img.dims), dicompath),
IVW_CONTEXT);
SourceContext{},
"image sizes differ in DICOM series '{}', expected {} but found {} ('{}')", desc,
toString(ref.dims), toString(img.dims), dicompath);
}
if (ref.pixelformat != img.pixelformat) {
throw DataReaderException(
fmt::format("pixel formats differ in DICOM series '{}' ('{}')", desc, dicompath),
IVW_CONTEXT);
throw DataReaderException(SourceContext{},
"pixel formats differ in DICOM series '{}' ('{}')", desc,
dicompath);
}
if (!ref.photometric.IsSameColorSpace(img.photometric)) {
throw DataReaderException(
fmt::format("photometric info differ in DICOM series '{}' ('{}')", desc, dicompath),
IVW_CONTEXT);
throw DataReaderException(SourceContext{},
"photometric info differ in DICOM series '{}' ('{}')", desc,
dicompath);
}
const double dicomDelta = 1.0e-4;
if (std::abs(ref.slope - img.slope) > dicomDelta ||
Expand Down Expand Up @@ -232,10 +231,9 @@ void Series::updateImageInformation(const std::filesystem::path& dicompath) {
continue;
}
if (!imageReader.Read()) {
throw DataReaderException(
fmt::format("could not read image '{}' in DICOM series '{}' ('{}')", imgInfo.path,
desc, dicompath),
IVW_CONTEXT);
throw DataReaderException(SourceContext{},
"could not read image '{}' in DICOM series '{}' ('{}')",
imgInfo.path, desc, dicompath);
}

imgInfo.updateInfo(imageReader);
Expand All @@ -249,19 +247,17 @@ void Series::updateImageInformation(const std::filesystem::path& dicompath) {
}

if (warnSlopeIntercept) {
LogWarn(
fmt::format("varying slopes/intercepts in DICOM series '{}' ('{}')", desc, dicompath));
log::warn("varying slopes/intercepts in DICOM series '{}' ('{}')", desc, dicompath);
}
if (warnPixelSpacing) {
LogWarn(fmt::format("pixel spacings differ in DICOM series '{}', expected {} ('{}')", desc,
toString(refImage.pixelSpacing), dicompath));
log::warn("pixel spacings differ in DICOM series '{}', expected {} ('{}')", desc,
toString(refImage.pixelSpacing), dicompath);
}
if (warnOrientation) {
LogWarn(
fmt::format("image orientations differ in DICOM series '{}' ('{}')", desc, dicompath));
log::warn("image orientations differ in DICOM series '{}' ('{}')", desc, dicompath);
}
if (warnOrigin) {
LogWarn(fmt::format("origins differ in DICOM series '{}' ('{}')", desc, dicompath));
log::warn("origins differ in DICOM series '{}' ('{}')", desc, dicompath);
}

util::erase_remove_if(images, [](dicomdir::Image& image) { return image.empty(); });
Expand Down
16 changes: 7 additions & 9 deletions medvis/dicom/src/errorlogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include <string>
#include <exception>
#include <ios>
#include <streambuf>
#include <ostream>
#include <iostream>
Expand Down Expand Up @@ -78,21 +77,20 @@ class StreambufLineout : public std::streambuf {
if (ch == '\n') {
if (!buffer.empty()) {
// at the end of a line we want to pass the message to Inviwo's logging system
inviwo::LogCentral::getPtr()->log("Gdcm Volume Importer", loglevel,
LogAudience::User, "<GDCM library>", "", 0,
buffer);
LogCentral::getPtr()->log("Gdcm Volume Importer", loglevel, LogAudience::User,
"<GDCM library>", "", 0, buffer);
}
buffer.clear();
} else if (!Traits::eq_int_type(ch, Traits::eof())) {
buffer.push_back(static_cast<CharT>(ch));
}
} catch (std::exception& ex) {
} catch (const std::exception& ex) {
// error while logging, print what we've got so far
inviwo::LogCentral::getPtr()->log("Gdcm Volume Importer", loglevel, LogAudience::User,
"<GDCM library>", "", 0, buffer);
LogCentral::getPtr()->log("Gdcm Volume Importer", loglevel, LogAudience::User,
"<GDCM library>", "", 0, buffer);
buffer.clear();
// and tell the user what hargspened
LogError("Exception while logging Gdcm: " << ex.what());
// and tell the user what happened
log::error("Exception while logging Gdcm: {}", ex.what());
// return traits::eof on failure
return Traits::eof();
}
Expand Down
Loading
Loading