35 #include <vtkImageImport.h>
36 #include <vtkImageData.h>
81 for (
unsigned i=0; i<this->
size(); ++i)
96 mDeleteFilesOnRelease(false)
98 QFileInfo info(baseFilename);
100 for (
int i=0;
true; ++i)
102 QString file = info.absolutePath()+
"/"+info.completeBaseName()+QString(
"_%1.mhd").arg(i);
104 if (!QFileInfo(file).exists())
108 mImages.push_back(cache);
110 if (size>=0 && i>=size)
121 mDeleteFilesOnRelease(false)
126 mDeleteFilesOnRelease(false)
128 for (
unsigned i=0; i<frames.size(); ++i)
139 if (mDeleteFilesOnRelease)
141 for (
unsigned i=0; i<mImages.size(); ++i)
155 if (index >= this->
size())
157 std::cout << QString(
"Attempt to call index %1, size=%2").arg(index).arg(this->
size()) << std::endl;
162 mImages[index]->purge();
168 return mImages[index]->getFilename();
174 return (
unsigned)mImages.size();
183 mOptionalWholeBase = image3D;
184 mImages.resize(image3D->GetDimensions()[2]);
186 for (
int i=0; i<mImages.size(); ++i)
190 import->SetImportVoidPointer(image3D->GetScalarPointer(0,0,i));
191 import->SetDataScalarType(image3D->GetScalarType());
192 import->SetDataSpacing(image3D->GetSpacing());
193 import->SetNumberOfScalarComponents(image3D->GetNumberOfScalarComponents());
199 import->SetWholeExtent(extent.data());
200 import->SetDataExtentToWholeExtent();
203 mImages[i] =
import->GetOutput();
213 return mImages[index];
218 return (
unsigned)mImages.size();
233 return mImages[index];
238 return mImages.size();
vtkImageDataPtr getImage()
#define CX_ASSERT(statement)
boost::shared_ptr< CachedImageData > CachedImageDataPtr
CachedImageDataContainer()
virtual QString getFilename(unsigned index)
virtual bool purge(unsigned index)
virtual vtkImageDataPtr get(unsigned index)
CachedImageData(QString filename, vtkImageDataPtr image=NULL)
virtual unsigned size() const
virtual unsigned size() const
virtual unsigned size() const
Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
virtual ~CachedImageDataContainer()
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
QString changeExtension(QString name, QString ext)
void append(QString filename)
virtual vtkImageDataPtr get(unsigned index)
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
virtual unsigned size() const =0
SplitFramesContainer(vtkImageDataPtr image3D)
virtual vtkImageDataPtr get(unsigned index)
FramesDataContainer(std::vector< vtkImageDataPtr > images)