Commit c06c861a authored by kirov's avatar kirov
Browse files

+ Roi default constructor test Roi params to 0

+ GetNextFrame() throws an exception
+ get/set Roi functions in FrameBuilder
+ code reorganization



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@36 45c4679d-1946-429d-baad-37912b19538b
parent cc500706
......@@ -3,6 +3,7 @@
#include <vector>
#include "SizeUtils.h"
#include "Exceptions.h"
namespace lima {
......@@ -18,31 +19,33 @@ class FrameBuilder {
public:
FrameBuilder();
FrameBuilder( Bin &bin, FrameDim &frame_dim,
FrameBuilder( FrameDim &frame_dim, Bin &bin, Roi &roi,
std::vector<struct GaussPeak> &peaks, double grow_factor );
~FrameBuilder();
void getNextFrame( unsigned char *ptr );
unsigned long getFrameNr();
void resetFrameNr( int frame_nr=0 );
void getFrameDim( FrameDim &dim ) const;
void setFrameDim( const FrameDim &dim );
void getBin( Bin &bin ) const;
void setBin( const Bin &bin );
void getFrameDim( FrameDim &dim ) const;
void setFrameDim( const FrameDim &dim );
void getRoi( Roi &roi ) const;
void setRoi( const Roi &roi );
void getNextFrame( unsigned char *ptr ) throw (Exception);
unsigned long getFrameNr();
void resetFrameNr( int frame_nr=0 );
private:
Roi m_roi;
Bin m_bin;
FrameDim m_frame_dim;
Bin m_bin;
Roi m_roi;
std::vector<struct GaussPeak> m_peaks;
double m_grow_factor;
unsigned long m_frame_nr;
int writeFrameData( unsigned char *ptr );
double dataXY( int x, int y );
template <class depth> void fillData( unsigned char *ptr );
};
......
......@@ -12,8 +12,9 @@ using namespace std;
FrameBuilder::FrameBuilder()
{
m_bin = Bin(1,1);
m_frame_dim = FrameDim(1024, 1024, Bpp16);
m_bin = Bin(1,1);
m_roi = Roi(); // ???
GaussPeak p={512, 512, 100, 100};
m_peaks.push_back(p);
m_grow_factor = 1.00;
......@@ -21,11 +22,12 @@ FrameBuilder::FrameBuilder()
}
FrameBuilder::FrameBuilder( Bin &bin, FrameDim &frame_dim,
FrameBuilder::FrameBuilder( FrameDim &frame_dim, Bin &bin, Roi &roi,
std::vector<struct GaussPeak> &peaks,
double grow_factor ):
m_bin(bin),
m_frame_dim(frame_dim),
m_bin(bin),
m_roi(roi),
m_peaks(peaks),
m_grow_factor(grow_factor)
{
......@@ -38,15 +40,15 @@ FrameBuilder::~FrameBuilder()
}
void FrameBuilder::resetFrameNr(int frame_nr)
void FrameBuilder::getFrameDim( FrameDim &dim ) const
{
m_frame_nr = frame_nr;
dim = m_frame_dim;
}
unsigned long FrameBuilder::getFrameNr()
void FrameBuilder::setFrameDim( const FrameDim &dim )
{
return m_frame_nr;
m_frame_dim = dim;
}
......@@ -62,15 +64,15 @@ void FrameBuilder::setBin( const Bin &bin )
}
void FrameBuilder::getFrameDim( FrameDim &dim ) const
void FrameBuilder::getRoi( Roi &roi ) const
{
dim = m_frame_dim;
roi = m_roi;
}
void FrameBuilder::setFrameDim( const FrameDim &dim )
void FrameBuilder::setRoi( const Roi &roi )
{
m_frame_dim = dim;
m_roi = roi;
}
......@@ -135,7 +137,7 @@ void FrameBuilder::fillData( unsigned char *ptr )
}
int FrameBuilder::writeFrameData(unsigned char *ptr)
void FrameBuilder::getNextFrame( unsigned char *ptr ) throw (Exception)
{
switch( m_frame_dim.getDepth() ) {
case 1 :
......@@ -148,20 +150,20 @@ int FrameBuilder::writeFrameData(unsigned char *ptr)
fillData<unsigned long>(ptr);
break;
default:
return -1;
throw Exception( Hardware, NotSupported, "",
__FILE__, __FUNCTION__, __LINE__ );
}
return 0;
++m_frame_nr;
}
void FrameBuilder::getNextFrame( unsigned char *ptr )
void FrameBuilder::resetFrameNr( int frame_nr )
{
int ret = writeFrameData( ptr );
m_frame_nr = frame_nr;
}
if( ret < 0 ) {
// throw an exception
} else {
m_frame_nr++;
}
unsigned long FrameBuilder::getFrameNr()
{
return m_frame_nr;
}
......@@ -75,5 +75,6 @@ int FrameDim::getImageTypeDepth(ImageType type)
Roi::Roi()
{
return;
m_top_left = Point(0, 0);
m_size = Size(0, 0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment