Changed VolumeTile::setImage(Image*) to setImage(uint i, Image*) to allow multiple images to be attached to single tile

This commit is contained in:
Robert Osfield 2008-12-21 20:42:29 +00:00
parent adced97dcd
commit f4c26f9cc8
4 changed files with 22 additions and 20 deletions

View File

@ -114,10 +114,9 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group
const osg::RefMatrix* getLocator() const { return _locator.get(); } const osg::RefMatrix* getLocator() const { return _locator.get(); }
void setImage(osg::Image* image) { _image = image; } void setImage(unsigned int i, osg::Image* image);
osg::Image* getImage() { return _image.get(); } osg::Image* getImage(unsigned int i) { return i<_images.size() ? _images[i].get() : 0; }
const osg::Image* getImage() const { return _image.get(); } const osg::Image* getImage(unsigned int i) const { return i<_images.size() ? _images[i].get() : 0; }
/** Set the VolumeTechnique*/ /** Set the VolumeTechnique*/
void setVolumeTechnique(VolumeTechnique* VolumeTechnique); void setVolumeTechnique(VolumeTechnique* VolumeTechnique);
@ -154,7 +153,9 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group
osg::ref_ptr<VolumeTechnique> _volumeTechnique; osg::ref_ptr<VolumeTechnique> _volumeTechnique;
osg::ref_ptr<osg::RefMatrix> _locator; osg::ref_ptr<osg::RefMatrix> _locator;
osg::ref_ptr<osg::Image> _image;
typedef std::vector< osg::ref_ptr<osg::Image> > Images;
Images _images;
}; };
} }

View File

@ -121,7 +121,7 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter
osg::ref_ptr<osgVolume::VolumeTile> tile = new osgVolume::VolumeTile; osg::ref_ptr<osgVolume::VolumeTile> tile = new osgVolume::VolumeTile;
tile->setVolume(volume.get()); tile->setVolume(volume.get());
tile->setImage(result.getImage()); tile->setImage(0, result.getImage());
// get matrix providing size of texels (in mm) // get matrix providing size of texels (in mm)
osg::RefMatrix* matrix = dynamic_cast<osg::RefMatrix*>(result.getImage()->getUserData()); osg::RefMatrix* matrix = dynamic_cast<osg::RefMatrix*>(result.getImage()->getUserData());

View File

@ -30,16 +30,16 @@ VolumeTile::VolumeTile():
setThreadSafeRefUnref(true); setThreadSafeRefUnref(true);
} }
VolumeTile::VolumeTile(const VolumeTile& brick,const osg::CopyOp& copyop): VolumeTile::VolumeTile(const VolumeTile& volumeTile,const osg::CopyOp& copyop):
Group(brick,copyop), Group(volumeTile,copyop),
_volume(0), _volume(0),
_dirty(false), _dirty(false),
_hasBeenTraversal(false), _hasBeenTraversal(false),
_image(brick._image) _images(volumeTile._images)
{ {
if (brick.getVolumeTechnique()) if (volumeTile.getVolumeTechnique())
{ {
setVolumeTechnique(osg::clone(brick.getVolumeTechnique())); setVolumeTechnique(osg::clone(volumeTile.getVolumeTechnique()));
} }
} }

View File

@ -138,19 +138,19 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::VolumeTile)
__C5_osg_RefMatrix_P1__getLocator, __C5_osg_RefMatrix_P1__getLocator,
"", "",
""); "");
I_Method1(void, setImage, IN, osg::Image *, image, I_Method2(void, setImage, IN, unsigned int, i, IN, osg::Image *, image,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__void__setImage__osg_Image_P1, __void__setImage__unsigned_int__osg_Image_P1,
"", "",
""); "");
I_Method0(osg::Image *, getImage, I_Method1(osg::Image *, getImage, IN, unsigned int, i,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__osg_Image_P1__getImage, __osg_Image_P1__getImage__unsigned_int,
"", "",
""); "");
I_Method0(const osg::Image *, getImage, I_Method1(const osg::Image *, getImage, IN, unsigned int, i,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__C5_osg_Image_P1__getImage, __C5_osg_Image_P1__getImage__unsigned_int,
"", "",
""); "");
I_Method1(void, setVolumeTechnique, IN, osgVolume::VolumeTechnique *, VolumeTechnique, I_Method1(void, setVolumeTechnique, IN, osgVolume::VolumeTechnique *, VolumeTechnique,
@ -186,9 +186,10 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::VolumeTile)
I_SimpleProperty(bool, Dirty, I_SimpleProperty(bool, Dirty,
__bool__getDirty, __bool__getDirty,
__void__setDirty__bool); __void__setDirty__bool);
I_SimpleProperty(osg::Image *, Image, I_IndexedProperty(osg::Image *, Image,
__osg_Image_P1__getImage, __osg_Image_P1__getImage__unsigned_int,
__void__setImage__osg_Image_P1); __void__setImage__unsigned_int__osg_Image_P1,
0);
I_SimpleProperty(osg::RefMatrix *, Locator, I_SimpleProperty(osg::RefMatrix *, Locator,
__osg_RefMatrix_P1__getLocator, __osg_RefMatrix_P1__getLocator,
__void__setLocator__osg_RefMatrix_P1); __void__setLocator__osg_RefMatrix_P1);