1 #include "ImageCanvasRectangularSelection.hh"
3 #include <Base/Image/ImageConvert.hh>
4 #include <Base/ImageUtils/ImageDraw.hh>
20 BIASERR(
"error: function of derived class should be called");
28 int sbarid, wxWindowID
id,
33 :
ImageCanvas(parent, sbar, sbarid, id, pos, size, style, name)
53 BIASDOUT(D_IC_IM,
"origim_ in SelectRectangle adr: "<<&
origim_);
70 OnLeftMouseButton(wxMouseEvent &event)
72 if (SelectRectangle_){
75 wxPoint pos =
event.GetPosition();
76 unsigned x = (unsigned) dc.DeviceToLogicalX( pos.x );
77 unsigned y = (unsigned) dc.DeviceToLogicalY( pos.y );
78 switch (NumLeftClicks_){
80 TopLeft_[0]=x; TopLeft_[1]=y;
85 BottomRight_[0]=x; BottomRight_[1]=y;
86 CallbackObj_->RectangleSelected(TopLeft_, BottomRight_);
87 SelectRectangle_=
false;
92 wxPostEvent(this->GetEventHandler(), pe);
96 BIASERR(
"something strange happend");
112 wxPostEvent(this->GetEventHandler(), pe);
134 wxPoint pos =
event.GetPosition();
135 int x = dc.DeviceToLogicalX( pos.x );
136 int y = dc.DeviceToLogicalY( pos.y );
148 unsigned char color[]={255, 0, 0};
151 int mtl[]={tl[0], tl[1]}, mbr[]={br[0], br[1]};
153 if (mtl[0]>mbr[0]) { tmp=mtl[0]; mtl[0]=mbr[0]; mbr[0]=tmp; }
154 if (mtl[1]>mbr[1]) { tmp=mtl[1]; mtl[1]=mbr[1]; mbr[1]=tmp; }
157 BIASDOUT(D_IC_IM,
"Rectangle drawn in Image adr: "<<&
rgbim_);
159 wxPostEvent(this->GetEventHandler(), pe);
168 BIASERR(
"error converting");
virtual void OnMouseMove(wxMouseEvent &event)
virtual ~ICECallbackInterface()
virtual void RectangleSelected(int tl[2], int br[2])
this function should be overloaded
provides functionality for selection of rectangle, point, ...
display image in wx application, provides zoom and investigation functionality
ImageCanvasRectangularSelection(wxWindow *parent, wxStatusBar *sbar=NULL, int sbarid=0, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(320, 240), long style=wxHSCROLL|wxVSCROLL, const wxString &name=AsciiToWx("ScrolledWindow"))
callback interface for ImageCanvasExtended
virtual void OnPaint(wxPaintEvent &event)
virtual void OnRightMouseButton(wxMouseEvent &event)
static int RectangleCorners(Image< StorageType > &im, const int minx, const int miny, const int maxx, const int maxy, const StorageType value[])
rectangles
void SelectRectangle(ICECallbackInterface &obj)
Call SelectRectangle with an object derived from ICECallbackInterface.
color values, 3 channels, order: red,green,blue
ICECallbackInterface * CallbackObj_
~ImageCanvasRectangularSelection()
enum EColorModel GetColorModel() const
void DrawRectangle_(int tl[2], int br[2])
BIAS::Image< unsigned char > rgbim_
static int Convert(BIAS::ImageBase &source, BIAS::ImageBase &dest, enum BIAS::ImageBase::EColorModel targetColorModel, bool bPlanar=false)
main general conversion function, calls desired specialized functions, always initializes the destIma...
virtual void Show(BIAS::Image< unsigned char > &im, std::string name="")