Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
6f22f49c
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f22f49c
编写于
4月 20, 2015
作者:
L
look4pritam
提交者:
Maksim Shabunin
7月 08, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Grassroots DiCoM i.e. GDCM based DICOM image reader is added.
上级
627e2b15
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
327 addition
and
0 deletion
+327
-0
CMakeLists.txt
CMakeLists.txt
+8
-0
cmake/OpenCVFindLibsGrfmt.cmake
cmake/OpenCVFindLibsGrfmt.cmake
+12
-0
cmake/templates/cvconfig.h.in
cmake/templates/cvconfig.h.in
+3
-0
modules/imgcodecs/CMakeLists.txt
modules/imgcodecs/CMakeLists.txt
+11
-0
modules/imgcodecs/src/gdcm_dicom.cpp
modules/imgcodecs/src/gdcm_dicom.cpp
+216
-0
modules/imgcodecs/src/gdcm_dicom.hpp
modules/imgcodecs/src/gdcm_dicom.hpp
+71
-0
modules/imgcodecs/src/loadsave.cpp
modules/imgcodecs/src/loadsave.cpp
+6
-0
未找到文件。
CMakeLists.txt
浏览文件 @
6f22f49c
...
...
@@ -191,6 +191,7 @@ OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
OCV_OPTION
(
WITH_OPENNI
"Include OpenNI support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
OCV_OPTION
(
WITH_OPENNI2
"Include OpenNI2 support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
OCV_OPTION
(
WITH_PNG
"Include PNG support"
ON
)
OCV_OPTION
(
WITH_GDCM
"Include DICOM support"
OFF
)
OCV_OPTION
(
WITH_PVAPI
"Include Prosilica GigE support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
OCV_OPTION
(
WITH_GIGEAPI
"Include Smartek GigE support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
OCV_OPTION
(
WITH_QT
"Build with Qt Backend support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
...
...
@@ -1008,6 +1009,7 @@ if(WITH_PNG)
else
()
status
(
" PNG:"
"NO"
)
endif
()
if
(
WITH_TIFF
)
if
(
TIFF_VERSION_STRING AND TIFF_FOUND
)
status
(
" TIFF:"
"
${
TIFF_LIBRARY
}
(ver
${
TIFF_VERSION
}
-
${
TIFF_VERSION_STRING
}
)"
)
...
...
@@ -1034,6 +1036,12 @@ else()
status
(
" GDAL:"
"NO"
)
endif
()
if
(
WITH_GDCM
)
status
(
" GDCM:"
GDCM_FOUND THEN
"YES (ver
${
GDCM_VERSION
}
)"
ELSE
"NO"
)
else
()
status
(
" GDCM:"
"NO"
)
endif
()
# ========================== VIDEO IO ==========================
status
(
""
)
status
(
" Video I/O:"
)
...
...
cmake/OpenCVFindLibsGrfmt.cmake
浏览文件 @
6f22f49c
...
...
@@ -212,3 +212,15 @@ if(WITH_GDAL)
ocv_include_directories
(
${
GDAL_INCLUDE_DIR
}
)
endif
()
endif
()
if
(
WITH_GDCM
)
find_package
(
GDCM
)
if
(
NOT GDCM_FOUND
)
set
(
HAVE_GDCM NO
)
ocv_clear_vars
(
GDCM_VERSION GDCM_LIBRARIES
)
else
()
set
(
HAVE_GDCM YES
)
# include(${GDCM_USE_FILE})
set
(
GDCM_LIBRARIES gdcmMSFF
)
# GDCM does not set this variable for some reason
endif
()
endif
()
cmake/templates/cvconfig.h.in
浏览文件 @
6f22f49c
...
...
@@ -111,6 +111,9 @@
/* libpng/png.h needs to be included */
#cmakedefine HAVE_LIBPNG_PNG_H
/* GDCM DICOM codec */
#cmakedefine HAVE_GDCM
/* V4L/V4L2 capturing support via libv4l */
#cmakedefine HAVE_LIBV4L
...
...
modules/imgcodecs/CMakeLists.txt
浏览文件 @
6f22f49c
...
...
@@ -35,6 +35,11 @@ if(HAVE_PNG)
list
(
APPEND GRFMT_LIBS
${
PNG_LIBRARIES
}
)
endif
()
if
(
HAVE_GDCM
)
ocv_include_directories
(
${
GDCM_INCLUDE_DIRS
}
)
list
(
APPEND GRFMT_LIBS
${
GDCM_LIBRARIES
}
)
endif
()
if
(
HAVE_TIFF
)
ocv_include_directories
(
${
TIFF_INCLUDE_DIR
}
)
list
(
APPEND GRFMT_LIBS
${
TIFF_LIBRARIES
}
)
...
...
@@ -57,6 +62,12 @@ endif()
file
(
GLOB grfmt_hdrs
${
CMAKE_CURRENT_LIST_DIR
}
/src/grfmt*.hpp
)
file
(
GLOB grfmt_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/grfmt*.cpp
)
if
(
HAVE_GDCM
)
list
(
APPEND grfmt_hdrs
${
CMAKE_CURRENT_LIST_DIR
}
/src/gdcm_dicom.hpp
)
list
(
APPEND grfmt_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/gdcm_dicom.cpp
)
endif
()
list
(
APPEND grfmt_hdrs
${
CMAKE_CURRENT_LIST_DIR
}
/src/bitstrm.hpp
)
list
(
APPEND grfmt_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/bitstrm.cpp
)
list
(
APPEND grfmt_hdrs
${
CMAKE_CURRENT_LIST_DIR
}
/src/rgbe.hpp
)
...
...
modules/imgcodecs/src/gdcm_dicom.cpp
0 → 100644
浏览文件 @
6f22f49c
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
#include "gdcm_dicom.hpp"
#include <gdcmImageReader.h>
namespace
cv
{
/************************ DICOM decoder *****************************/
DICOMDecoder
::
DICOMDecoder
()
{
/// DICOM preable is 128 bytes (can have any vale, defaults to x00) + 4 bytes magic number (DICM)
m_signature
=
""
;
for
(
int
iSize
=
0
;
iSize
<
128
;
iSize
++
)
{
m_signature
=
m_signature
+
"
\xFF
"
;
}
m_signature
=
m_signature
+
"
\x44\x49\x43\x4D
"
;
m_buf_supported
=
false
;
}
DICOMDecoder
::~
DICOMDecoder
()
{
}
bool
DICOMDecoder
::
checkSignature
(
const
String
&
signature
)
const
{
size_t
len
=
signatureLength
();
bool
bOK
=
signature
.
size
()
>=
len
;
for
(
int
iIndex
=
128
;
iIndex
<
len
;
iIndex
++
)
{
if
(
signature
[
iIndex
]
==
m_signature
[
iIndex
])
{
continue
;
}
else
{
bOK
=
false
;
break
;
}
}
return
(
bOK
);
}
void
DICOMDecoder
::
close
()
{
}
ImageDecoder
DICOMDecoder
::
newDecoder
()
const
{
return
makePtr
<
DICOMDecoder
>
();
}
bool
DICOMDecoder
::
readHeader
()
{
gdcm
::
ImageReader
csImageReader
;
csImageReader
.
SetFileName
(
m_filename
.
c_str
());
if
(
!
csImageReader
.
Read
())
{
return
(
false
);
}
bool
bOK
=
true
;
const
gdcm
::
Image
&
csImage
=
csImageReader
.
GetImage
();
if
(
(
csImage
.
GetPhotometricInterpretation
()
==
gdcm
::
PhotometricInterpretation
::
MONOCHROME1
)
||
(
csImage
.
GetPhotometricInterpretation
()
==
gdcm
::
PhotometricInterpretation
::
MONOCHROME2
)
)
{
gdcm
::
PixelFormat
ePixelFormat
=
csImage
.
GetPixelFormat
();
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
INT8
)
{
m_type
=
CV_8SC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
UINT8
)
{
m_type
=
CV_8UC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
INT16
)
{
m_type
=
CV_16SC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
UINT16
)
{
m_type
=
CV_16UC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
INT32
)
{
m_type
=
CV_32SC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
FLOAT32
)
{
m_type
=
CV_32FC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
FLOAT64
)
{
m_type
=
CV_64FC1
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
INT12
)
{
bOK
=
false
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
UINT12
)
{
bOK
=
false
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
UINT32
)
{
bOK
=
false
;
}
else
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
SINGLEBIT
)
{
bOK
=
false
;
}
else
{
bOK
=
false
;
}
}
else
if
(
csImage
.
GetPhotometricInterpretation
()
==
gdcm
::
PhotometricInterpretation
::
RGB
)
{
gdcm
::
PixelFormat
ePixelFormat
=
csImage
.
GetPixelFormat
();
if
(
ePixelFormat
==
gdcm
::
PixelFormat
::
UINT8
)
{
m_type
=
CV_8UC3
;
}
else
{
bOK
=
false
;
}
}
else
{
bOK
=
false
;
}
if
(
bOK
)
{
const
unsigned
int
*
piDimension
=
csImage
.
GetDimensions
();
m_width
=
piDimension
[
0
];
m_height
=
piDimension
[
1
];
if
(
(
m_width
<=
0
)
||
(
m_height
<=
0
)
)
{
bOK
=
false
;
}
}
return
(
bOK
);
}
bool
DICOMDecoder
::
readData
(
Mat
&
csImage
)
{
csImage
.
create
(
m_width
,
m_height
,
m_type
);
gdcm
::
ImageReader
csImageReader
;
csImageReader
.
SetFileName
(
m_filename
.
c_str
());
if
(
!
csImageReader
.
Read
())
{
return
(
false
);
}
bool
bOK
=
true
;
const
gdcm
::
Image
&
csGDCMImage
=
csImageReader
.
GetImage
();
bOK
=
csGDCMImage
.
GetBuffer
((
char
*
)
csImage
.
ptr
());
return
(
bOK
);
}
}
modules/imgcodecs/src/gdcm_dicom.hpp
0 → 100644
浏览文件 @
6f22f49c
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _GDCM_DICOM_H_
#define _GDCM_DICOM_H_
#include "grfmt_base.hpp"
namespace
cv
{
// DICOM image reader using GDCM
class
DICOMDecoder
:
public
BaseImageDecoder
{
public:
DICOMDecoder
();
~
DICOMDecoder
();
bool
readData
(
Mat
&
img
);
bool
readHeader
();
void
close
();
ImageDecoder
newDecoder
()
const
;
virtual
bool
checkSignature
(
const
String
&
signature
)
const
;
protected:
};
}
#endif
/*_GDCM_DICOM_H_*/
modules/imgcodecs/src/loadsave.cpp
浏览文件 @
6f22f49c
...
...
@@ -45,6 +45,9 @@
#include "precomp.hpp"
#include "grfmts.hpp"
#ifdef HAVE_GDCM
#include "gdcm_dicom.hpp"
#endif
#undef min
#undef max
#include <iostream>
...
...
@@ -93,6 +96,9 @@ struct ImageCodecInitializer
decoders
.
push_back
(
makePtr
<
PngDecoder
>
()
);
encoders
.
push_back
(
makePtr
<
PngEncoder
>
()
);
#endif
#ifdef HAVE_GDCM
decoders
.
push_back
(
makePtr
<
DICOMDecoder
>
()
);
#endif
#ifdef HAVE_JASPER
decoders
.
push_back
(
makePtr
<
Jpeg2KDecoder
>
()
);
encoders
.
push_back
(
makePtr
<
Jpeg2KEncoder
>
()
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录