14 #include <QStringList> 15 #include <vtkPointData.h> 16 #include <vtkPolyData.h> 17 #include <vtkPolyDataMapper.h> 19 #include <vtkCellArray.h> 20 #include <vtkProperty.h> 21 #include <vtkMatrix4x4.h> 39 mActor = vtkActorPtr::New();
52 mLines = vtkCellArrayPtr::New();
91 mActor->GetProperty()->SetColor(color.redF(), color.greenF(), color.blueF());
99 return QString(
"Shape x [cm]");
102 return QString(
"Shape y [cm]");
105 return QString(
"Shape z [cm]");
136 QStringList bufferList = buffer.split(
" ");
138 for(
int i = 0; i <
mAxis.size(); ++i)
160 if((bufferList.size() < 2) || !this->
toInt(bufferList[pos++], numValues))
164 int stopPos = pos + numValues;
165 if(stopPos > bufferList.size())
167 CX_LOG_WARNING() <<
"ReadFbgsMessage::readPosForOneAxis: Buffer don't have enough (" << numValues <<
") values along axis: " <<
getAxisString(axis);
170 for(; pos < stopPos; ++pos)
173 if(!this->
toDouble(bufferList[pos], value))
175 axisVextor->push_back(value*10);
183 value =
string.toInt(&ok);
185 CX_LOG_WARNING() <<
"ReadFbgsMessage::toInt: Cannot convert " <<
string <<
" to int";
191 string =
string.split(
'\n')[0];
193 value =
string.toDouble(&ok);
197 ok = this->
toInt(
string, intValue);
198 value = double(intValue);
200 CX_LOG_WARNING() <<
"ReadFbgsMessage::toDouble: Cannot convert " <<
string <<
" to double";
208 for(
int i = startFrom; i < bufferList.size(); ++i)
209 if (bufferList[i] == axisString)
212 CX_LOG_WARNING() <<
"ReadFbgsMessage::getAxisStringPosition: Could't find separator string: " << axisString;
222 CX_LOG_WARNING() <<
"ReadFbgsMessage::createPolyData: Not equal number of position data in all axes";
231 mPoints->InsertNextPoint(p_pr.begin());
236 std::vector<vtkIdType> ids(
mPoints->GetNumberOfPoints());
237 for (
unsigned i=0; i<ids.size(); ++i)
239 mLines->InsertNextCell(ids.size(), &(*ids.begin()));
269 int pos1 = pos - localRange;
270 int pos2 = pos + localRange;
309 mMesh->getProperties().mLineWidth->setValue(5);
330 QString export_folder =
mServices->session()->getSubFolder(
"Export");
331 QString filename = export_folder+
"/"+
mMesh->getUid()+
"_" + QDateTime::currentDateTime().toString(
timestampSecondsFormat()) +
".vtk";
void readBuffer(QString buffer)
vtkSmartPointer< class vtkActor > vtkActorPtr
std::vector< double > mXaxis
vtkPolyDataPtr getPolyData()
int mShapePointLockNumber
boost::shared_ptr< class VisServices > VisServicesPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Vector3D getDeltaPosition(int pos)
Transform3D createTransformRotationBetweenVectors(Vector3D from, Vector3D to)
std::vector< double > mZaxis
vtkPolyDataMapperPtr mPolyDataMapper
virtual Transform3D lockShape(int position)
QString timestampSecondsFormat()
void setShapePointLock(int posNumber)
static MeshPtr create(const QString &uid, const QString &name="", PatientModelServicePtr patientModelService=PatientModelService::getNullObject(), SpaceProviderPtr spaceProvider=SpaceProvider::getNullObject())
static QString getMeshUid()
bool toDouble(QString string, double &value)
Transform3D createTransformTranslate(const Vector3D &translation)
void setColor(QColor color)
bool toInt(QString string, int &value)
QString getAxisString(AXIS axis)
int getAxisStringPosition(QStringList &bufferList, AXIS axis, int startFrom)
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
int readPosForOneAxis(AXIS axis, QStringList &bufferList, int previousPos)
std::vector< double > * getAxisPosVector(AXIS axis)
std::vector< double > mYaxis
ReadFbgsMessage(VisServicesPtr services)
void set_prMt(Transform3D prMt)
boost::shared_ptr< class Mesh > MeshPtr
std::vector< AXIS > mAxis
vtkPolyDataPtr mPolyData
polydata representation of the probe, in space u
Namespace for all CustusX production code.