8 #include <MGXViewer/qglviewer.h>
26 friend class process::SetupProcess;
88 void setMain(
Store* m);
107 void setWork(
Store* w);
140 return multiply(_step, scale());
147 return size_t(_size.x()) * _size.y() * _size.z();
160 return (_showScale ? _scale :
Point3f(1.0, 1.0, 1.0));
167 return multiply(scale(), _origin);
180 void setOrigin(
const Point3f& s);
187 void setSize(
const Point3u& s);
191 void setStep(
const Point3f& s);
252 Matrix4f worldToImageVector()
const;
255 Matrix4f imageToWorldVector()
const;
260 return multiply(
Point3f(img) +
Point3f(.5f, .5f, .5f), step()) + origin();
272 return multiply(
Point3f(img), step());
284 return BoundingBox3f(imageToWorld(img.pmin()), imageToWorld(img.pmax()));
294 return worldToImage<float>(a);
296 Point3i worldToImagei(
const Point3f& a)
const {
297 return worldToImage<int>(a);
299 Point3u worldToImageu(
const Point3f& a)
const {
300 return worldToImage<uint>(a);
303 BoundingBox3f worldToImagef(
const BoundingBox3f& a)
const {
304 return worldToImage<float>(a);
306 BoundingBox3i worldToImagei(
const BoundingBox3f& a)
const {
307 return worldToImage<int>(a);
309 BoundingBox3u worldToImageu(
const BoundingBox3f& a)
const {
310 return worldToImage<uint>(a);
313 Point3f worldToImageVectorf(
const Point3f& a)
const {
314 return worldToImageVector<float>(a);
316 Point3i worldToImageVectori(
const Point3f& a)
const {
317 return worldToImageVector<int>(a);
319 Point3u worldToImageVectoru(
const Point3f& a)
const {
320 return worldToImageVector<uint>(a);
330 return divide(p, scale()) * _texScale;
337 return imageToWorldVector(_size);
343 if(x < 0 or y < 0 or z < 0 or x >=
int(_size.x()) or y >=
int(_size.y()) or z >=
int(_size.z()))
350 size_t offset(uint x, uint y, uint z)
const {
351 return (
size_t(z) * _size.y() + y) * _size.x() + x;
358 return (
size_t(ipos.
z()) * _size.y() + ipos.
y()) * _size.x() + ipos.
x();
364 uint x = offset % _size.
x();
365 offset = (offset - x) / _size.x();
366 uint y = offset % _size.y();
367 uint z = (offset - y) / _size.y();
410 return (_showTrans ? _trans : _frame);
420 return (_showTrans ? _trans : _frame);
434 changed_label =
true;
442 changed_label =
true;
444 if(_CurrLabel > ((1 << 16) - 1))
452 return changed_label;
455 void setMainAsCurrent() {
458 void setWorkAsCurrent() {
461 void setNoneAsCurrent() {
465 void setCurrentStore(Store* store) {
466 _current = (store == _main or store == _work) ? store : 0;
475 void resetModified();
478 Store* _main, *_work, *_current;
487 bool changed_frame, changed_trans, changed_label;
490 bool _showScale, _showTrans, _showBBox, _tieScales;
int nextLabel()
Return the next label to be used and change it so successive calls return successive labels...
Definition: Stack.hpp:440
Store * work()
Access the work store.
Definition: Stack.hpp:99
const qglviewer::ManipulatedFrame & frame() const
Returns the manipulated frame.
Definition: Stack.hpp:379
Store * currentStore()
Returns the current store.
Definition: Stack.hpp:118
const qglviewer::ManipulatedFrame & trans() const
Returns the transformation frame.
Definition: Stack.hpp:393
util::Vector< 3, T > worldToImageVector(Point3f wrld) const
Go from world coordinates to image coordinates (for a vector)
Definition: Stack.hpp:276
int id() const
Id of a stack.
Definition: Stack.hpp:49
const qglviewer::ManipulatedFrame & getFrame() const
Returns the active frame (i.e.
Definition: Stack.hpp:419
size_t offset(Point3i ipos) const
Returns the position, in the image, of the point of image coordinate ipos.
Definition: Stack.hpp:357
Point3u position(size_t offset) const
Compute the position from the offset.
Definition: Stack.hpp:362
const Store * currentStore() const
Returns the current store.
Definition: Stack.hpp:112
void setShowTrans(bool s)
Set if the stack should be transformed.
Definition: Stack.hpp:228
Store * main()
Access the main store.
Definition: Stack.hpp:80
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
Definition: Vector.hpp:651
BoundingBox3i boundingBox() const
Returns the bounding box, in voxels, of the stores.
Definition: Stack.hpp:131
qglviewer::ManipulatedFrame & getFrame()
Returns the active frame (i.e.
Definition: Stack.hpp:409
void setShowScale(bool s)
Set if the stack should be scaled.
Definition: Stack.hpp:202
void setTieScales(bool s)
Set if the scales should be tied.
Definition: Stack.hpp:215
Point3f step() const
Returns the size, in micro-meters, of a voxel.
Definition: Stack.hpp:138
void setId(int i)
Change the id of the stack.
Definition: Stack.hpp:58
The Store class holds the actual 3D data and properties specific to it.
Definition: Store.hpp:25
Point3f imageToWorld(const util::Vector< 3, T > &img) const
Go from image coordinates to world coordinates (for a point)
Definition: Stack.hpp:258
bool tieScales() const
True if the 3 scaling axis are tied together.
Definition: Stack.hpp:209
Point3f scale() const
Scaling factor to apply, if scaled.
Definition: Stack.hpp:159
util::Vector< 3, T > worldToImage(Point3f wrld) const
Go from world coordinates to image coordinates (for a point)
Definition: Stack.hpp:264
BoundingBox3f imageToWorld(const util::BoundingBox< 3, T > &img) const
Go from image coordinates to world coordinates (for a point)
Definition: Stack.hpp:282
qglviewer::ManipulatedFrame & frame()
Returns the manipulated frame.
Definition: Stack.hpp:386
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
CU_HOST_DEVICE void y(const T &v)
Short access to the second element.
Definition: Vector.hpp:660
int viewLabel() const
Return the label to be used.
Definition: Stack.hpp:426
void setScale(Point3f s)
Set the scaling factor of the stack.
Definition: Stack.hpp:173
Point3f worldSize() const
Size of the image, in world coordinate.
Definition: Stack.hpp:336
size_t offset(uint x, uint y, uint z) const
Compute offset for image data.
Definition: Stack.hpp:350
bool showBBox() const
True if the Bounding Box of the stack is shown.
Definition: Stack.hpp:235
Point3f origin() const
Position of the point (0,0,0) of the image, in world coordinate.
Definition: Stack.hpp:166
Point3f abstractToWorld(const Point3f &p) const
Go from abstract unit to world unit.
Definition: Stack.hpp:328
qglviewer::ManipulatedFrame & trans()
Returns the transformation frame.
Definition: Stack.hpp:399
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:25
util::BoundingBox< 3, T > worldToImage(const BoundingBox3f &wrld) const
Go from world coordinates to image coordinates (for a point)
Definition: Stack.hpp:288
void setShowBBox(bool s)
Set if the bounding box of the stack should be visible.
Definition: Stack.hpp:241
Class representing a fixed-size matrix.
Definition: Matrix.hpp:34
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
Definition: Vector.hpp:669
bool showScale() const
True if the stack is scaled.
Definition: Stack.hpp:196
bool boundsOK(int x, int y, int z) const
Check if (x,y,z) is in the image.
Definition: Stack.hpp:341
const Store * work() const
Access the work store.
Definition: Stack.hpp:93
Point3u size() const
Returns the size, in voxels, of the stores.
Definition: Stack.hpp:125
void setLabel(int l)
Change the label to be used.
Definition: Stack.hpp:432
size_t storeSize() const
Returns the size, in number of elements, of the stores.
Definition: Stack.hpp:146
int userId() const
Id as seen by the user.
Definition: Stack.hpp:67
const Store * main() const
Access the main store.
Definition: Stack.hpp:74
bool labelChanged() const
Returns true if the label changed during this process.
Definition: Stack.hpp:451
Point3f imageToWorldVector(const util::Vector< 3, T > &img) const
Go from image coordinates to world coordinates (for a vector)
Definition: Stack.hpp:270
bool empty() const
True if the stack is empty (i.e.
Definition: Stack.hpp:152
bool showTrans() const
True if the stack is shown transformed.
Definition: Stack.hpp:222