Go to the documentation of this file.
22 #include <MGXViewer/qglviewer.h>
49 static const uint RELOAD_NONE = 0x0;
50 static const uint RELOAD_MAIN = 0x1;
51 static const uint RELOAD_WORK = 0x2;
52 static const uint RELOAD_TRIS = 0x4;
53 static const uint RELOAD_LINES = 0x8;
54 static const uint RELOAD_POS = 0x10;
55 static const uint RELOAD_VBO = 0x20;
56 static const uint UPDATE_SELECTION = 0x40;
212 ImgData(
int id, QWidget* _parent = 0);
219 void setWork16Bit(
bool val);
220 void setMain16Bit(
bool val);
223 void readParms(
Parms& parms, QString section);
226 void writeParms(QTextStream& pout, QString section);
241 void drawStack(
Shader* shader);
244 void setColorMap(
const QString& pth,
bool work);
247 void updateHeatHistogram();
249 void updateSurfHistogram();
251 void updateWorkHistogram();
253 void updateMainHistogram();
256 void editMainTransferFunction();
257 void editWorkTransferFunction();
258 void editSurfTransferFunction();
259 void editHeatTransferFunction();
264 updateColorMap(newSurfColorMap, SurfColorMap, mesh->
surfFct());
268 updateColorMap(newHeatColorMap, HeatColorMap, mesh->
heatFct());
272 updateColorMap(newWorkColorMap, WorkColorMap, stack->
work()->
transferFct());
276 updateColorMap(newMainColorMap, MainColorMap, stack->
main()->
transferFct());
278 void updateColorMap(
bool& newColorMap, std::vector<TransferFunction::Colorf>&
ColorMap,
308 std::vector<TransferFunction::Colorf> empty;
312 void setupColorMap(
bool& newColorMap, GLuint& cmapTexId,
316 bool setupTexFromColorMap(GLuint &texId,
const ColorbVec &colorVec);
322 void drawVertexVertexLine(
ImgData* stack);
331 void setup3DRenderingData(
Shader* shader);
336 void drawSurf(
bool select,
Shader* textureShader = 0,
Shader* labelShader = 0,
349 void setupVolumeShader(
Shader& shader,
int pos);
355 bool clipTest(
const Point3i& ip);
364 void initControls(QWidget* viewer);
369 void reloadLabelTex();
372 void reloadTex(GLuint texId);
376 void bind2DTex(GLuint texId);
379 void loadImgTex(
const QImage& image);
382 void fillLabel(
const IntSet &label,
int currlabel);
385 void setParent(
int label,
int parentLabel);
386 void setParent(
const IntSet &labels,
int parentLabel);
389 void selectLabel(
int label,
int repeat = 0);
390 void selectLabel(
const IntSet &labels);
393 void unselectLabel(
const IntSet &labels);
396 void selectParent(
int label,
int repeat = 0);
397 void selectParent(
const IntSet &labels);
400 void unselectParent(
const IntSet &parents);
403 void selectConnected(std::vector<uint>& vlist,
bool unselect);
406 void selectVertices(std::vector<uint>& vlist,
bool unselect);
409 void addSeed(
int label, std::vector<uint>& vlist);
412 void fillSelect(
int label);
415 void deleteLabel(
int label);
418 void updatePoints(
uint &VCount,
uint &LCount,
uint &TCount);
424 void updateNextLabel();
427 void updateTriColor();
436 void updateSelectTris();
439 void updateImageTex2d();
442 void updateCellGraph();
451 bool startSelectFbo();
454 bool stopSelectFbo();
457 bool readSelectFbo();
460 void correctSelection(
bool inclusive);
463 void updateSelection();
469 void findSelectTriangle(
uint x,
uint y, std::vector<uint>& vlist,
int& label,
470 bool useParentLabel =
true);
475 void clearMeshSelect();
478 void addSelect(
const VtxVec &vList);
481 void removeSelect(
const VtxVec &vlist);
495 const Point3f& pz,
bool doCut,
int currentLabel);
498 void voxelEditStop();
510 return isMainVisible() or isWorkVisible();
532 if(texId == workDataTexId)
533 return stack->
work()->
labels() ? GL_NEAREST : GL_LINEAR;
535 return stack->
main()->
labels() ? GL_NEAREST : GL_LINEAR;
540 if(texId == workDataTexId)
541 return Work16Bit ? GL_ALPHA16 : GL_ALPHA8;
543 return Main16Bit ? GL_ALPHA16 : GL_ALPHA8;
548 if(texId == workDataTexId)
555 void updateStackSize();
558 void setTexScale(
float s);
562 return stack->
storeSize() > 0 and (mainDataTexId or workDataTexId);
567 void updLabel(
int label, std::vector<uint>& vlist);
570 void load3DTexData(
const GLuint texId,
const Point3u size,
const ushort* data);
577 float trimTex(
const float val) {
return (
trim(val, 0.0f, 1.0f)); }
584 bool testQuad(
float a,
float b,
float c,
float d,
float x)
586 if(a > x and b > x and c > x and d > x)
588 if(a < -x and b < -x and c < -x and d < -x)
600 else if(v->minb != 0 or v->label < 0)
612 if(mesh->
meshView() ==
"Border" and !(a->margin and b->margin))
614 if(mesh->
meshView() ==
"Cells" and !(a->label == -1 and b->label == -1))
627 if(x < 0 or y < 0 or z < 0 or x >=
int(stack->
size().
x()) or y >=
int(stack->
size().
y())
628 or z >=
int(stack->
size().
z()))
648 int toSliderScale(
float s);
649 float fromSliderScale(
int i);
652 void updateHistogram(std::vector<double>& hist,
const HVecUS& data, std::pair<double, double>& minMaxValues,
653 int max_data = 1 << 16,
int size = 512);
660 memset(&data[0], 0, data.size() *
sizeof(
ushort));
674 if(v1->label > 0 and v1->label != label)
676 if(v2->label > 0 and v2->label != label)
678 if(v3->label > 0 and v3->label != label)
693 void changedInterface();
695 void stackUnloaded();
699 void updateLineColor();
702 void MainShowSlot(
bool val);
703 void MainBrightSlot(
int val);
704 void MainOpacitySlot(
int val);
705 void MainLabelsSlot(
bool val);
706 void Main16BitSlot(
bool val);
707 void MainColorMapSlot();
709 void WorkShowSlot(
bool val);
710 void WorkBrightSlot(
int val);
711 void WorkOpacitySlot(
int val);
712 void WorkLabelsSlot(
bool val);
713 void Work16BitSlot(
bool val);
714 void WorkColorMapSlot();
716 void SurfShowSlot(
bool val);
717 void SurfBrightSlot(
int val);
718 void SurfOpacitySlot(
int val);
719 void SurfBlendSlot(
bool val);
720 void SurfCullSlot(
bool val);
722 void SurfVertexSlot(
bool val);
723 void SurfTriangleSlot(
bool val);
724 void SurfLabelSlot(
bool val);
726 void VertexViewSlot(
const QString &s);
727 void TriangleViewSlot(
const QString &s);
728 void LabelViewSlot(
const QString &s);
730 void VertexColorMapSlot();
731 void TriangleColorMapSlot();
732 void LabelColorMapSlot();
734 void SurfParentSlot(
bool val);
736 void MeshShowSlot(
bool val);
737 void ChangeMeshViewModeSlot(
const QString &s);
738 void AxisShowSlot(
bool val);
739 void ChangeAxisViewModeSlot(
const QString &s);
740 void MeshLinesSlot(
bool val);
741 void MeshPointsSlot(
bool val);
743 void ViewerUpdateSlot(
void);
744 void UpdateColorMapSlot(
void);
746 void CellMapSlot(
bool val);
747 void ShowTransSlot(
bool val);
748 void ShowScaleSlot(
bool val);
749 void ShowBBoxSlot(
bool val);
750 void TieScalesSlot(
bool val);
751 void ScaleSlotX(
int val);
752 void ScaleSlotY(
int val);
753 void ScaleSlotZ(
int val);
769 void updateSliderScale();
770 void forceSurfHeat();
771 void toggleEditLabels();
GLenum internalFormat(GLuint texId)
bool showTransparentSurface()
void updateMainColorMap()
std::vector< double > WorkHist
static float MeshLineWidth
std::vector< vertex > VtxVec
Vector of vertices.
std::vector< uint > cellGraphLineVA
Point3u size() const
Returns the size, in voxels, of the stores.
Matrix4f worldToImage() const
Matrix transforming a world point to an image one.
static Colorf getColor(ColorType type)
void updateHeatColorMap()
TransferFunction heatFct() const
Return the transfer function used to draw the surface in heat mode.
Vector< 4, vertex > Point4v
QString meshView() const
Return the current view mode for the mesh.
std::vector< uint > cellGraphPointVA
std::vector< TransferFunction::Colorf > SurfColorMap
const Store * work() const
Access the work store.
void setupWorkColorMap2()
bool showSurface() const
True if the surface is currently visible to the user.
std::vector< Point3GLub > selVA
bool lDraw(const vertex &a, const vertex &b)
std::vector< double > MainHist
bool labels() const
Returns true if the data is to be interpreted as labels rather than intensities.
std::pair< double, double > workBounds
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
std::pair< double, double > mainBounds
Colors::ColorType MeshBorderColor
std::vector< Point3f > pntsVA
thrust::host_vector< ushort > HVecUS
bool setLabel(vertex v1, vertex v2, vertex v3, int label)
static int VoxelEditRadius
std::vector< uint > pcellVA
Point3f worldToImagef(const Point3f &a) const
std::vector< uint > lbrdVA
unsigned short ushort
Simpler names for the various containers and iterators.
Colors::ColorType MeshSelectColor
GLuint cellGraphColorVAid
const Store * main() const
Access the main store.
bool isMainVisible() const
std::vector< uint > lcellVA
float opacity() const
Get the current opacity level of the surface.
ColorType
Mesh1 and 2 must have the same order for their colors.
std::vector< Point3f > texVA
intptr_t vertex_identity_t
Type of the identifier of a vertex.
std::vector< Point3f > cellGraphPosVA
Distributed matrix library.
size_t offset(Point3i ipos)
std::vector< Point3f > nrmlVA
std::vector< uint > pbrdVA
qglviewer::ManipulatedFrame & getTransFrame()
Vector< 3, GLubyte > Point3GLub
size_t storeSize() const
Returns the size, in number of elements, of the stores.
std::vector< Point2f > imgVA
static bool DeleteBadVertex
TransferFunction transferFct() const
Retrieve the transfer function used to render the volume.
static int VoxelEditMaxPix
std::vector< uint > lineVA
TransferFunction surfFct() const
Return the transfer function used to draw the surface in normal mode.
TransferFunctionDlg * workTransferDlg
Point3i worldToImagei(const Point3f &a) const
std::vector< Point3f > posVA
BoundingBox< 3, int > BoundingBox3i
std::vector< vertex > idVA
T CU_HOST_DEVICE max(const T a, const T b)
CU_HOST_DEVICE T trim(const T x, const T minx, const T maxx)
std::vector< Point3GLub > pcolVA
std::vector< cell > triCell
float trimTex(const float val)
Point2f trimTex(const Point2f &val)
size_t offset(uint x, uint y, uint z)
void setupLabelColorMap()
std::vector< QString > ImageFiles
static float DrawZeroLabels
Point3u worldToImageu(const Point3f &a) const
CU_HOST_DEVICE void y(const T &v)
Short access to the second element.
ColorEditDlg * triangleColorEditDlg
std::vector< Colorb > ColorbVec
void invalidateHistogram(std::vector< double > &hist)
static Point3u MaxTexSize
std::vector< Point3GLub > cellGraphColorVA
std::vector< Colorb > cellColorVA
std::set< int > IntSet
Set of integers.
std::vector< Point3f > axisPosVA
std::vector< Colorb > triangleColorVA
std::vector< TransferFunction::Colorf > WorkColorMap
std::vector< Point3GLub > axisColorVA
const qglviewer::ManipulatedFrame & frame() const
Returns the manipulated frame.
Vector< 3, T > worldToImage(Point3f wrld) const
Go from world coordinates to image coordinates.
static float MeshPointSize
bool isWorkVisible() const
GLenum interpolation(GLuint texId)
size_t offset(uint x, uint y, uint z) const
Compute offset for image data.
bool isVisible() const
Is the store currently visible.
Colors::ColorType MeshColor
Matrix4f imageToWorld() const
Matrix transforming an image point to a world one.
qglviewer::ManipulatedFrame & getFrame()
Vector< 2, float > Point2f
thrust::host_vector< Point4f > HVec4F
bool blending() const
Return if the surface is rendered blended or not.
std::vector< TransferFunction::Colorf > MainColorMap
const qglviewer::ManipulatedFrame & trans() const
Returns the transformation frame.
Namespace containing all the utility classes.
Point3f imageToWorld(const Vector< 3, T > &img) const
Go from image coordinates to world coordinates.
bool boundsOK(int x, int y, int z)
std::vector< uint > lselVA
const HVecUS & currentData() const
bool testQuad(float a, float b, float c, float d, float x)
std::vector< double > SurfHist
void updateSurfColorMap()
qglviewer::ManipulatedFrame & getMainFrame()
GLenum swapTextureBytes(GLuint texId)
void clearData(HVecUS &data)
static std::vector< Colorf > LabelColors
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
std::vector< double > HeatHist
HVecUS & data()
Actual 3D data store linearly in a host vector.
A utility class to parse L-Studio like parameter files.
std::vector< TransferFunction::Colorf > HeatColorMap
qglviewer::ManipulatedFrame & getFrame()
Returns the active frame (i.e.
void updateWorkColorMap()
std::vector< uint > pselVA
Point3GLub pColor(const vertex &v)
void setupMainColorMap2()