1

对于我的 UE4 项目,我想使用 C++ 的 GDCM 库来加载 CT 扫描。所以最近几天我真的尝试了很多,但我仍然无法使用 GDCM ......但是错误在哪里?有人能帮我吗?

  • 我用 CMake (VS 2013 Win64) 成功创建了 dll 和 lib 文件。
  • 我把所有的库都放在 ...Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Libraries
  • 我使用 PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmMSFF.lib")); 在 VolumeImport.Build.cs 中添加了 16 个库中的每一个库。PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmCommon.lib")); ...
  • 我把所有的头文件放在 Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Includes
  • 我在项目属性中将包含路径设置为该位置。
  • 我把所有的 dll 放在 C:\Windows\System32

然后我使用了标题:

#include "VolumeImport.h"

#include <gdcmVersion.h>
#include <gdcmReader.h>
#include <gdcmPixmapReader.h>
#include <gdcmImageReader.h>
#include <gdcmAttributes.h>

bool CTFileLoader::Convert_DICOM()
{
    /** ... other well working code ... */

    gdcm::Trace::SetDebug(false); gdcm::Trace::SetError(true);

    gdcm::ImageReader reader;
    reader.SetFilename(files_to_process[i].c_str()); 
    if(!reader.Read()) { }

}   

我在 gdcmMediaStorage.h 中收到错误:“错误 C4515:'gdcm':命名空间使用自身。”

我尝试使用不同的包含,但这会导致不同标题中的不同错误......库有问题吗?但我确信它们已被添加,因为仅使用 gdcmTrace.h 和 gdcm::Trace::functions 可以正常工作。

4

1 回答 1

1

现在我得到了解决方案:

  • 在我的 VolumeImport.Build.cs 中,我还添加了 DLL: PublicDelayLoadDLLs.Add(Path.Combine(LibrariesPath, "gdcmMSFF.dll")); ...
  • 我更改了 gdcmMediaStorage.h 文件:注释掉“using namespace gdcm;”
  • 此外,我在这个大库中遇到了 dynamic_cast 问题,它需要启用 RTTI
于 2015-10-08T07:13:22.970 回答