34#ifndef AIMS_IO_QTFORMATSW_H
35#define AIMS_IO_QTFORMATSW_H
38#include <aims/io/datatypecode.h>
39#include <aims/data/pheader.h>
40#include <cartodata/volume/volume.h>
41#include <aims/rgb/rgb.h>
42#include <cartobase/exception/ioexcept.h>
43#include <cartobase/stream/fileutil.h>
44#include <cartobase/type/string_conversion.h>
46#include <qapplication.h>
63 const std::string & filename,
64 unsigned zfame,
unsigned tframe );
65 std::string
format()
const;
70 static QRgb convertColor(
const T & );
75 inline QtFormatsWriter<T> &
78 writer.write( thing );
87 std::string fmt =
format();
89 if( !qApp && ( fmt ==
"EPS" || fmt ==
"EPSF" || fmt ==
"EPSI" ) )
97 vs[0], vs[1], vs[2], vs[3] );
111 for( t=0; t<dt; ++t )
112 for( z=0; z<dz; ++z, ++i )
135 const std::string & filename,
136 unsigned z,
unsigned t )
139 QImage im( dx, dy, QImage::Format_RGB32 );
142 im = im.convertToFormat( QImage::Format_ARGB32 );
144 im.setDotsPerMeterX( (
int) rint( 1000 / vs[0] ) );
145 im.setDotsPerMeterY( (
int) rint( 1000 / vs[1] ) );
146 for( y=0; y<dy; ++y )
147 for( x=0; x<dx; ++x )
148 im.setPixel( x, y, convertColor( thing.
at( x, y, z, t ) ) );
149 if( !im.save( filename.c_str(),
160 const std::string & filename,
161 unsigned z,
unsigned t )
164 QImage im( dx, dy, QImage::Format_Indexed8 );
166 im.setDotsPerMeterX( (
int) rint( 1000 / vs[0] ) );
167 im.setDotsPerMeterY( (
int) rint( 1000 / vs[1] ) );
168 for( x=0; x<256; ++x )
169 im.setColor( x, qRgb( x, x, x ) );
170 for( y=0; y<dy; ++y )
171 for( x=0; x<dx; ++x )
172 im.setPixel( x, y, thing.
at( x, y, z, t ) );
173 if( !im.save( filename.c_str(),
181 template<
typename T>
inline
182 QRgb QtFormatsWriter<T>::convertColor(
const T & x )
184 return qRgb( x, x, x );
189 QRgb QtFormatsWriter<AimsRGB>::convertColor(
const AimsRGB & x )
196 QRgb QtFormatsWriter<AimsRGBA>::convertColor(
const AimsRGBA & x )
virtual void copyProperties(Object source)
static std::string dirname(const std::string &)
static std::string extension(const std::string &)
static std::string removeExtension(const std::string &)
Object reference(Object &value)
virtual void setProperty(const std::string &, Object)
std::vector< float > getVoxelSize() const
const T & at(long x, long y=0, long z=0, long t=0) const
const uint8_t & alpha() const
const uint8_t & blue() const
const uint8_t & red() const
const uint8_t & green() const
const uint8_t & red() const
const uint8_t & green() const
const uint8_t & blue() const
static void launchErrnoExcept(const std::string &filename="")
AIMSDATA_API PovWriter< D, T > & operator<<(PovWriter< D, T > &writer, const AimsTimeSurface< D, T > &thing)
std::string stringUpper(const std::string &)