Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
mia
2d
rgbimageio.hh
Go to the documentation of this file.
1
/* -*- mia-c++ -*-
2
*
3
* This file is part of MIA - a toolbox for medical image analysis
4
* Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
5
*
6
* MIA is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
#ifndef mia_2d_rgbimageio_hh
22
#define mia_2drgbimageio_hh
23
24
#include <vector>
25
#include <
mia/2d/defines2d.hh
>
26
#include <
mia/2d/vector.hh
>
27
#include <
mia/core/iodata.hh
>
28
#include <
mia/core/ioplugin.hh
>
29
#include <
mia/core/iohandler.hh
>
30
31
NS_MIA_BEGIN
32
33
/*
34
\brief Quick and dirty class to store RGB unsigned char images
35
36
This class is a very shallow inmplementation of a 2D RGB image that may
37
only be used to hold tha data and save it. Main purpoise is its use to create
38
some nice and colorfull output.
39
This implementation has nothing to do with T2DImage.
40
41
*/
42
43
44
class
EXPORT_2D
CRGB2DImage
:
public
mia::CIOData{
45
public
:
47
typedef
std::shared_ptr<CRGB2DImage>
Pointer
;
48
50
static
const
char
*
data_descr
;
51
53
typedef
CRGB2DImage
type
;
54
59
CRGB2DImage
(
const
mia::C2DBounds
& size);
60
62
const
mia::C2DBounds
& get_size()
const
;
63
65
const
unsigned
char
*pixel()
const
;
66
68
unsigned
char
*pixel();
69
70
/* provide a cloing mechanism for this image. This is only needed because
71
we use the plug-in handler infrastructure to provide the IO for this class
72
and the handler needs to be able to clone the data for internal storage.
73
*/
74
CRGB2DImage
*clone()
const
;
75
private
:
76
mia::C2DBounds
m_size;
77
std::vector<unsigned char> m_pixels;
78
79
};
80
81
83
typedef
CRGB2DImage::Pointer
PRGB2DImage
;
84
86
typedef
mia::TIOPlugin<CRGB2DImage>
C2DRGBImageIOPlugin
;
87
88
93
typedef
mia::THandlerSingleton< mia::TIOPluginHandler<C2DRGBImageIOPlugin> >
C2DRGBImageIOPluginPluginHandler
;
94
99
typedef
C2DRGBImageIOPluginPluginHandler::Instance::DataKey
C2DRGBImageDataKey
;
100
109
bool
EXPORT_2D
save_image
(
const
std::string& filename,
const
CRGB2DImage
& image);
110
111
NS_MIA_END
112
113
#endif
Generated on Tue Oct 15 2013 13:56:37 by
1.8.4