C# GDCM 函数指针,无法转换为 SWIGTYPE
C# GDCM function pointer, cannot convert to SWIGTYPE
我正在使用 GDCM 读取 DICOM 文件。由于该项目是在 C# 中,我已经按照 GDCM 的手册使用 SWIG 编译了 GDCM 的 C# 包装。
现在我正在尝试将文件夹中的所有 DICOM 分类到卷中(很像 VolumeSorter example provided by GDCM, however, this is written in c++). I'm following the SortImage2.cs 示例,但这不会编译,给我错误:
Error CS1503 Argument 1: cannot convert from 'method group' to
'SWIGTYPE_p_f_r_q_const__gdcm__DataSet_r_q_const__gdcm__DataSet__bool'
New Unity Project.CSharp ...\Scripts\SortImage2.cs 33
完整示例如下:
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
using System;
using gdcm;
public class SortImage2
{
bool mysort(DataSet ds1, DataSet ds2)
{
return false;
}
public static int Main(string[] args)
{
Sorter sorter = new Sorter();
sorter.SetSortFunction( mysort );
return 0;
}
}
我假设它无法解释
有没有办法 "cast" 将方法转换为预期类型?或者这是 GDCM 的 SWIG 设置错误?
您所描述的示例实际上已被注释掉,如下所示:
我怀疑这是一个从未完成的功能。
我正在使用 GDCM 读取 DICOM 文件。由于该项目是在 C# 中,我已经按照 GDCM 的手册使用 SWIG 编译了 GDCM 的 C# 包装。
现在我正在尝试将文件夹中的所有 DICOM 分类到卷中(很像 VolumeSorter example provided by GDCM, however, this is written in c++). I'm following the SortImage2.cs 示例,但这不会编译,给我错误:
Error CS1503 Argument 1: cannot convert from 'method group' to 'SWIGTYPE_p_f_r_q_const__gdcm__DataSet_r_q_const__gdcm__DataSet__bool' New Unity Project.CSharp ...\Scripts\SortImage2.cs 33
完整示例如下:
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
using System;
using gdcm;
public class SortImage2
{
bool mysort(DataSet ds1, DataSet ds2)
{
return false;
}
public static int Main(string[] args)
{
Sorter sorter = new Sorter();
sorter.SetSortFunction( mysort );
return 0;
}
}
我假设它无法解释 有没有办法 "cast" 将方法转换为预期类型?或者这是 GDCM 的 SWIG 设置错误?
您所描述的示例实际上已被注释掉,如下所示:
我怀疑这是一个从未完成的功能。