18 #include <MGXViewer/qglviewer.h> 36 friend class process::SetupProcess;
98 void setMain(
Store* m);
117 void setWork(
Store* w);
150 return multiply(_step, scale());
157 return size_t(_size.x()) * _size.y() * _size.z();
170 return (_showScale ? _scale :
Point3f(1.0, 1.0, 1.0));
177 return multiply(scale(), _origin);
190 void setOrigin(
const Point3f& s);
197 void setSize(
const Point3u& s);
201 void setStep(
const Point3f& s);
262 Matrix4f worldToImageVector()
const;
265 Matrix4f imageToWorldVector()
const;
270 return multiply(
Point3f(img) +
Point3f(.5f, .5f, .5f), step()) + origin();
282 return multiply(
Point3f(img), step());
294 return BoundingBox3f(imageToWorld(img.pmin()), imageToWorld(img.pmax()));
304 return worldToImage<float>(a);
307 return worldToImage<int>(a);
310 return worldToImage<uint>(a);
314 return worldToImage<float>(a);
317 return worldToImage<int>(a);
320 return worldToImage<uint>(a);
324 return worldToImageVector<float>(a);
327 return worldToImageVector<int>(a);
330 return worldToImageVector<uint>(a);
340 return divide(p, scale()) * _texScale;
347 return imageToWorldVector(_size);
353 if(x < 0 or y < 0 or z < 0 or x >=
int(_size.x()) or y >=
int(_size.y()) or z >=
int(_size.z()))
360 size_t offset(uint x, uint y, uint z)
const {
361 return (
size_t(z) * _size.y() + y) * _size.x() + x;
368 return (
size_t(ipos.
z()) * _size.y() + ipos.
y()) * _size.x() + ipos.
x();
374 uint x = offset % _size.
x();
375 offset = (offset - x) / _size.x();
376 uint y = offset % _size.y();
377 uint z = (offset - y) / _size.y();
420 return (_showTrans ? _trans : _frame);
430 return (_showTrans ? _trans : _frame);
444 changed_label =
true;
452 changed_label =
true;
454 if(_CurrLabel > ((1 << 16) - 1))
462 return changed_label;
465 void setMainAsCurrent() {
468 void setWorkAsCurrent() {
471 void setNoneAsCurrent() {
475 void setCurrentStore(
Store* store) {
476 _current = (store == _main or store == _work) ? store : 0;
485 void resetModified();
488 Store* _main, *_work, *_current;
497 bool changed_frame, changed_trans, changed_label;
500 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:450
Store * work()
Access the work store.
Definition: Stack.hpp:109
const qglviewer::ManipulatedFrame & frame() const
Returns the manipulated frame.
Definition: Stack.hpp:389
Store * currentStore()
Returns the current store.
Definition: Stack.hpp:128
const qglviewer::ManipulatedFrame & trans() const
Returns the transformation frame.
Definition: Stack.hpp:403
util::Vector< 3, T > worldToImageVector(Point3f wrld) const
Go from world coordinates to image coordinates (for a vector)
Definition: Stack.hpp:286
int id() const
Id of a stack.
Definition: Stack.hpp:59
const qglviewer::ManipulatedFrame & getFrame() const
Returns the active frame (i.e.
Definition: Stack.hpp:429
size_t offset(Point3i ipos) const
Returns the position, in the image, of the point of image coordinate ipos.
Definition: Stack.hpp:367
Point3u position(size_t offset) const
Compute the position from the offset.
Definition: Stack.hpp:372
const Store * currentStore() const
Returns the current store.
Definition: Stack.hpp:122
void setShowTrans(bool s)
Set if the stack should be transformed.
Definition: Stack.hpp:238
Store * main()
Access the main store.
Definition: Stack.hpp:90
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
Definition: Vector.hpp:661
BoundingBox3i boundingBox() const
Returns the bounding box, in voxels, of the stores.
Definition: Stack.hpp:141
qglviewer::ManipulatedFrame & getFrame()
Returns the active frame (i.e.
Definition: Stack.hpp:419
void setShowScale(bool s)
Set if the stack should be scaled.
Definition: Stack.hpp:212
void setTieScales(bool s)
Set if the scales should be tied.
Definition: Stack.hpp:225
Point3f step() const
Returns the size, in micro-meters, of a voxel.
Definition: Stack.hpp:148
void setId(int i)
Change the id of the stack.
Definition: Stack.hpp:68
The Store class holds the actual 3D data and properties specific to it.
Definition: Store.hpp:35
Point3f imageToWorld(const util::Vector< 3, T > &img) const
Go from image coordinates to world coordinates (for a point)
Definition: Stack.hpp:268
bool tieScales() const
True if the 3 scaling axis are tied together.
Definition: Stack.hpp:219
Point3f scale() const
Scaling factor to apply, if scaled.
Definition: Stack.hpp:169
util::Vector< 3, T > worldToImage(Point3f wrld) const
Go from world coordinates to image coordinates (for a point)
Definition: Stack.hpp:274
BoundingBox3f imageToWorld(const util::BoundingBox< 3, T > &img) const
Go from image coordinates to world coordinates (for a point)
Definition: Stack.hpp:292
qglviewer::ManipulatedFrame & frame()
Returns the manipulated frame.
Definition: Stack.hpp:396
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:670
int viewLabel() const
Return the label to be used.
Definition: Stack.hpp:436
void setScale(Point3f s)
Set the scaling factor of the stack.
Definition: Stack.hpp:183
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Point3f worldSize() const
Size of the image, in world coordinate.
Definition: Stack.hpp:346
size_t offset(uint x, uint y, uint z) const
Compute offset for image data.
Definition: Stack.hpp:360
bool showBBox() const
True if the Bounding Box of the stack is shown.
Definition: Stack.hpp:245
Point3f origin() const
Position of the point (0,0,0) of the image, in world coordinate.
Definition: Stack.hpp:176
Point3f abstractToWorld(const Point3f &p) const
Go from abstract unit to world unit.
Definition: Stack.hpp:338
qglviewer::ManipulatedFrame & trans()
Returns the transformation frame.
Definition: Stack.hpp:409
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:35
util::BoundingBox< 3, T > worldToImage(const BoundingBox3f &wrld) const
Go from world coordinates to image coordinates (for a point)
Definition: Stack.hpp:298
void setShowBBox(bool s)
Set if the bounding box of the stack should be visible.
Definition: Stack.hpp:251
Class representing a fixed-size matrix.
Definition: Matrix.hpp:44
This namespace contains all the classes needed to define processes.
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
Definition: Vector.hpp:679
bool showScale() const
True if the stack is scaled.
Definition: Stack.hpp:206
bool boundsOK(int x, int y, int z) const
Check if (x,y,z) is in the image.
Definition: Stack.hpp:351
const Store * work() const
Access the work store.
Definition: Stack.hpp:103
Point3u size() const
Returns the size, in voxels, of the stores.
Definition: Stack.hpp:135
void setLabel(int l)
Change the label to be used.
Definition: Stack.hpp:442
size_t storeSize() const
Returns the size, in number of elements, of the stores.
Definition: Stack.hpp:156
int userId() const
Id as seen by the user.
Definition: Stack.hpp:77
const Store * main() const
Access the main store.
Definition: Stack.hpp:84
bool labelChanged() const
Returns true if the label changed during this process.
Definition: Stack.hpp:461
Point3f imageToWorldVector(const util::Vector< 3, T > &img) const
Go from image coordinates to world coordinates (for a vector)
Definition: Stack.hpp:280
bool empty() const
True if the stack is empty (i.e.
Definition: Stack.hpp:162
bool showTrans() const
True if the stack is shown transformed.
Definition: Stack.hpp:232