Moved osgVolume::ImageUtils to osg::ImageUtils, updated wrappers, and started moving osgvolume example across to create osgVolume subgraphs

This commit is contained in:
Robert Osfield
2009-01-09 15:19:25 +00:00
parent 9b4c6e25ea
commit 458993fa88
13 changed files with 155 additions and 97 deletions

View File

@@ -8,6 +8,7 @@
#include <osg/Geode>
#include <osg/GL>
#include <osg/io_utils>
#include <osg/ImageUtils>
#include <osgDB/FileNameUtils>
#include <osgDB/FileUtils>
@@ -15,7 +16,6 @@
#include <osgVolume/Volume>
#include <osgVolume/VolumeTile>
#include <osgVolume/ImageUtils>
#ifdef USE_DCMTK
#define HAVE_CONFIG_H
@@ -121,7 +121,10 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter
osg::ref_ptr<osgVolume::VolumeTile> tile = new osgVolume::VolumeTile;
tile->setVolume(volume.get());
tile->setImage(0, result.getImage());
osg::ref_ptr<osgVolume::Layer> layer= new osgVolume::ImageLayer(result.getImage());
tile->addLayer(layer.get());
// get matrix providing size of texels (in mm)
osg::RefMatrix* matrix = dynamic_cast<osg::RefMatrix*>(result.getImage()->getUserData());
@@ -134,7 +137,7 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter
osg::Vec3d scale(osg::Vec3(result.getImage()->s(),result.getImage()->t(), result.getImage()->r()));
matrix->postMultScale(scale);
tile->setLocator(matrix);
tile->setLocator(new osgVolume::Locator(*matrix));
result.getImage()->setUserData(0);
@@ -637,15 +640,15 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter
image->allocateImage(dcmImage->getWidth(), dcmImage->getHeight(), totalNumSlices,
pixelFormat, dataType);
osgVolume::copyImage(previous_image.get(), 0,0,0, previous_image->s(), previous_image->t(), imageNum,
image.get(), 0, 0, 0,
false);
osg::copyImage(previous_image.get(), 0,0,0, previous_image->s(), previous_image->t(), imageNum,
image.get(), 0, 0, 0,
false);
}
osgVolume::copyImage(imageAdapter.get(), 0,0,0, imageAdapter->s(), imageAdapter->t(), imageAdapter->r(),
image.get(), 0, 0, imageNum,
false);
osg::copyImage(imageAdapter.get(), 0,0,0, imageAdapter->s(), imageAdapter->t(), imageAdapter->r(),
image.get(), 0, 0, imageNum,
false);
imageNum += dcmImage->getFrameCount();
}

View File

@@ -4,7 +4,7 @@ INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} )
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIB_DIRS})
SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} )
SET(TARGET_ADDED_LIBRARIES osgWidget osgVolume)
SET(TARGET_ADDED_LIBRARIES osgWidget)
#### end var setup ###
SETUP_PLUGIN(pdf pdf)

View File

@@ -16,7 +16,7 @@
#include <osgDB/FileUtils>
#include <osgWidget/PdfReader>
#include <osgVolume/ImageUtils>
#include <osg/ImageUtils>
#include <cairo.h>
#include <poppler.h>
@@ -200,7 +200,7 @@ class PopplerPdfImage : public osgWidget::PdfImage
_cairoImage->create((unsigned int)(w*2.0),(unsigned int)(h*2.0));
osgVolume::clearImageToColor(this, _backgroundColor);
osg::clearImageToColor(this, _backgroundColor);
cairo_save(_cairoImage->getContext());