rgbimageio.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_2d_rgbimageio_hh
#define mia_2d_rgbimageio_hh
#include <vector>
#include <mia/2d/defines2d.hh>
#include <mia/2d/vector.hh>
#include <mia/core/iodata.hh>
#include <mia/core/ioplugin.hh>
#include <mia/core/iohandler.hh>
NS_MIA_BEGIN
/*
\brief Quick and dirty class to store RGB unsigned char images
This class is a very shallow inmplementation of a 2D RGB image that may
only be used to hold tha data and save it. Main purpoise is its use to create
some nice and colorfull output.
This implementation has nothing to do with T2DImage.
*/
class EXPORT_2D CRGB2DImage : public mia::CIOData
{
public:
typedef std::shared_ptr<CRGB2DImage> Pointer;
static const char *data_descr;
typedef CRGB2DImage type;
CRGB2DImage(const mia::C2DBounds& size);
const mia::C2DBounds& get_size() const;
const unsigned char *pixel() const;
unsigned char *pixel();
/* provide a cloing mechanism for this image. This is only needed because
we use the plug-in handler infrastructure to provide the IO for this class
and the handler needs to be able to clone the data for internal storage.
*/
CRGB2DImage *clone() const;
private:
mia::C2DBounds m_size;
std::vector<unsigned char> m_pixels;
};
typedef CRGB2DImage::Pointer PRGB2DImage;
typedef TIOPlugin<CRGB2DImage> C2DRGBImageIOPlugin;
extern template class EXPORT_2D TPlugin<CRGB2DImage, io_plugin_type>;
extern template class EXPORT_2D TIOPlugin<CRGB2DImage>;
typedef mia::THandlerSingleton< mia::TIOPluginHandler<C2DRGBImageIOPlugin>> C2DRGBImageIOPluginPluginHandler;
typedef C2DRGBImageIOPluginPluginHandler::Instance::DataKey C2DRGBImageDataKey;
bool EXPORT_2D save_image(const std::string& filename, const CRGB2DImage& image);
NS_MIA_END
#endif
vector.hh
CRGB2DImage
Definition rgbimageio.hh:45
CRGB2DImage::Pointer
std::shared_ptr< CRGB2DImage > Pointer
unifying pointer definition for this class.
Definition rgbimageio.hh:48
CRGB2DImage::get_size
const mia::C2DBounds & get_size() const
CRGB2DImage::clone
CRGB2DImage * clone() const
CRGB2DImage::pixel
unsigned char * pixel()
CRGB2DImage::pixel
const unsigned char * pixel() const
CRGB2DImage::type
CRGB2DImage type
data type for the plug-in handler magic
Definition rgbimageio.hh:54
CRGB2DImage::data_descr
static const char * data_descr
data type description used by the plug-in handler to locate the plug-ins
Definition rgbimageio.hh:51
CRGB2DImage::CRGB2DImage
CRGB2DImage(const mia::C2DBounds &size)
TIOPlugin
The templatex basis class of all IO plug-ins.
Definition ioplugin.hh:58
TPlugin
The generic base for all plug-ins.
Definition plugin_base.hh:172
defines2d.hh
EXPORT_2D
#define EXPORT_2D
Definition defines2d.hh:37
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
C2DRGBImageIOPluginPluginHandler
mia::THandlerSingleton< mia::TIOPluginHandler< C2DRGBImageIOPlugin > > C2DRGBImageIOPluginPluginHandler
The 2D RGB image plugin handler.
Definition rgbimageio.hh:95
C2DRGBImageDataKey
C2DRGBImageIOPluginPluginHandler::Instance::DataKey C2DRGBImageDataKey
The data key type for the CDatapool storage.
Definition rgbimageio.hh:101
iodata.hh
iohandler.hh
ioplugin.hh
save_image
bool EXPORT_2D save_image(const std::string &filename, const CRGB2DImage &image)
PRGB2DImage
CRGB2DImage::Pointer PRGB2DImage
The shared pointer type of the image.
Definition rgbimageio.hh:84
C2DRGBImageIOPlugin
TIOPlugin< CRGB2DImage > C2DRGBImageIOPlugin
Base type for 2D RGB image IO plugins.
Definition rgbimageio.hh:87