/usr/include/mia-2.4/mia/2d/rgbimageio.hh is in libmia-2.4-dev 2.4.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /* -*- 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:
/// unifying pointer definition for this class.
typedef std::shared_ptr<CRGB2DImage> Pointer;
/// data type description used by the plug-in handler to locate the plug-ins
static const char *data_descr;
/// data type for the plug-in handler magic
typedef CRGB2DImage type;
/**
Create an image of the given size
\param size
*/
CRGB2DImage(const mia::C2DBounds& size);
/// \returns the dimensions of the image
const mia::C2DBounds& get_size() const;
/// \returns a raw read-only pointer to the pixel data
const unsigned char *pixel() const;
/// \returns a raw read-write pointer to the pixel data
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;
};
/// The shared pointer type of the image
typedef CRGB2DImage::Pointer PRGB2DImage;
/// Base type for 2D RGB image IO plugins
typedef TIOPlugin<CRGB2DImage> C2DRGBImageIOPlugin;
extern template class EXPORT_2D TPlugin<CRGB2DImage, io_plugin_type>;
extern template class EXPORT_2D TIOPlugin<CRGB2DImage>;
/**
@ingroup io
\brief The 2D RGB image plugin handler
*/
typedef mia::THandlerSingleton< mia::TIOPluginHandler<C2DRGBImageIOPlugin> > C2DRGBImageIOPluginPluginHandler;
/**
@ingroup io
\brief The data key type for the CDatapool storage
*/
typedef C2DRGBImageIOPluginPluginHandler::Instance::DataKey C2DRGBImageDataKey;
/**
Save an RGB image to the file with the given file name. The type of the image
file is determined by the filename extension.
\param filename
\param image image to be saved
\returns true if the image was saved successfully. If the saving failes,
the function may also throw some exception providing an error message.
*/
bool EXPORT_2D save_image(const std::string& filename, const CRGB2DImage& image);
NS_MIA_END
#endif
|