11 #include <vtkSmartPointer.h>
25 std::string type_ =
"unknown") {
27 this->
detail.center_x = (p1[0] + p2[0]) / 2;
28 this->
detail.center_y = (p1[1] + p2[1]) / 2;
29 this->
detail.center_z = (p1[2] + p2[2]) / 2;
31 this->
detail.length = p2[0] - p1[0];
32 this->
detail.width = p2[1] - p1[1];
33 this->
detail.height = p2[2] - p1[2];
51 sprintf(buffer,
"%s %f %f %f %f %f %f %f",
type.c_str(),
data[0],
53 return std::string(buffer);
57 class vtkBalloonWidget;
64 class vtkRenderWindowInteractor;
66 class vtkPolyDataMapper;
77 Annotation(
const std::vector<int>& slice, std::string type_);
94 std::vector<int>& slice,
116 void picked(vtkRenderWindowInteractor* interactor);
133 void setType(
const std::string value);
137 const std::vector<int>&
getSlice()
const;
156 const std::vector<int>& slice);
177 std::vector<double*> anchorPoints;
179 std::vector<int> m_slice;
192 static std::vector<std::string>*
GetTypes();
215 static void ComputeOBB(
const PointCloudI::Ptr cloud,
216 std::vector<int>& slice,
224 static std::vector<std::string>*
types;
229 explicit Annotaions(vtkRenderWindowInteractor* interactor =
nullptr);
263 std::vector<Annotation*>& annotations);
int getLabelByIndex(std::size_t index)
Annotaions(vtkRenderWindowInteractor *interactor=nullptr)
void loadAnnotations(std::string filename, int mode)
load annotations from file
void add(Annotation *anno)
void updateBalloonByIndex(std::size_t index)
std::vector< Annotation * > m_annotations
keep all annotation from current cloud
Annotation * getAnnotation(vtkActor *actor)
from annotatin box actor to find annotation itself
void saveAnnotations(std::string filename, int mode)
save annotations to file
vtkSmartPointer< vtkBalloonWidget > m_balloonWidget
void remove(Annotation *anno)
void preserve(size_t num=0)
void updateLabels(Annotation *anno, bool resetFlag=false)
void updateBalloonByAnno(Annotation *anno)
std::vector< Annotation * > & getAnnotations()
int * m_labeledCloudIndex
vtkRenderWindowInteractor * m_interactor
int getAnnotationIndex(Annotation *anno)
BoxLabel getBoxLabel()
getBoxLabel get boxLabel from annotaion tranformation
void applyTransform(vtkSmartPointer< vtkTransform > t)
apply transform to annotation
void picked(vtkRenderWindowInteractor *interactor)
enter picked state, show boxwidget which allow to adjust annotation
static std::size_t GetTypeIndex(std::string type_)
GetTypeIndex auto add to vector map if has not.
static std::vector< std::string > * GetTypes()
get types vector pointer
static std::vector< std::string > * types
types all annotation type here
Annotation(const std::vector< int > &slice, std::string type_)
Annotation construct from slice which load from label file.
vtkSmartPointer< vtkActor > getActor() const
void colorAnnotation(int color_index=-1)
color the annotation with given color
void unpicked()
disable boxWidget
void setAnchorPoint(const PointCloudI::Ptr cloud, const std::vector< int > &slice)
copy selected points as anchor to current annotation
void adjustToAnchor()
keep current orientation, re-compute the center and scale to make annotation fit to selected point we...
std::string getType() const
double computeScaleAndCenterShift(double o[3], double scs[2])
computeScaleAndCenterShift
const std::vector< int > & getSlice() const
void setType(const std::string value)
change the type of annotation, and color too
static std::string GetTypeByIndex(size_t index)
GetTypeByIndex auto add to vector map if has not.
static void ComputeOBB(const PointCloudI::Ptr cloud, std::vector< int > &slice, double p1[3], double p2[3])
ComputeOBB compute max,min [x,y,z] aligned to xyz axis.
BoxLabel(const double p1[3], const double p2[3], std::string type_="unknown")
struct BoxLabel::@53::@55 detail