34 #ifndef AIMS_IO_QTFORMATSW_H 35 #define AIMS_IO_QTFORMATSW_H 46 #include <qapplication.h> 63 unsigned zfame,
unsigned tframe );
64 std::string
format()
const;
69 static QRgb convertColor(
const T & );
75 operator << ( QtFormatsWriter<T> & writer,
const AimsData<T> & thing )
77 writer.write( thing );
86 std::string fmt =
format();
88 if( !qApp && ( fmt ==
"EPS" || fmt ==
"EPSF" || fmt ==
"EPSI" ) )
91 unsigned t, z, dt = thing.
dimT(), dz = thing.
dimZ();
102 std::vector<std::string> files = hdr.outputFilenames();
104 hdr.setProperty(
"file_type",
format() );
105 hdr.setProperty(
"filenames", files );
110 for( t=0; t<dt; ++t )
111 for( z=0; z<dz; ++z, ++i )
115 + hdr.extension() +
".minf" );
134 const std::string & filename,
135 unsigned z,
unsigned t )
137 int x, y, dx = thing.
dimX(), dy = thing.
dimY();
138 QImage im( dx, dy, QImage::Format_RGB32 );
141 im = im.convertToFormat( QImage::Format_ARGB32 );
142 im.setDotsPerMeterX( (
int) rint( 1000 / thing.
sizeX() ) );
143 im.setDotsPerMeterY( (
int) rint( 1000 / thing.
sizeY() ) );
144 for( y=0; y<dy; ++y )
145 for( x=0; x<dx; ++x )
146 im.setPixel( x, y, convertColor( thing( x, y, z, t ) ) );
147 if( !im.save( filename.c_str(),
157 const std::string & filename,
158 unsigned z,
unsigned t )
160 int x, y, dx = thing.
dimX(), dy = thing.
dimY();
161 QImage im( dx, dy, QImage::Format_Indexed8 );
162 im.setDotsPerMeterX( (
int) rint( 1000 / thing.
sizeX() ) );
163 im.setDotsPerMeterY( (
int) rint( 1000 / thing.
sizeY() ) );
164 for( x=0; x<256; ++x )
165 im.setColor( x, qRgb( x, x, x ) );
166 for( y=0; y<dy; ++y )
167 for( x=0; x<dx; ++x )
168 im.setPixel( x, y, thing( x, y, z, t ) );
169 if( !im.save( filename.c_str(),
177 template<
typename T>
inline 180 return qRgb( x, x, x );
const uint8_t & blue() const
static std::string extension(const std::string &)
const uint8_t & red() const
static std::string removeExtension(const std::string &)
std::string stringUpper(const std::string &)
static void launchErrnoExcept(const std::string &filename="")
static std::string dirname(const std::string &)
const uint8_t & alpha() const
const aims::Header * header() const
const uint8_t & green() const
const uint8_t & blue() const
const uint8_t & green() const
const uint8_t & red() const