14 #include <vtkImageImport.h> 15 #include <vtkImageData.h> 60 for (
unsigned i=0; i<this->size(); ++i)
75 mDeleteFilesOnRelease(false)
77 QFileInfo info(baseFilename);
79 for (
int i=0;
true; ++i)
81 QString file = info.absolutePath()+
"/"+info.completeBaseName()+QString(
"_%1.mhd").arg(i);
83 if (!QFileInfo(file).exists())
87 mImages.push_back(cache);
89 if (size>=0 && i>=size)
100 mDeleteFilesOnRelease(false)
105 mDeleteFilesOnRelease(false)
107 for (
unsigned i=0; i<frames.size(); ++i)
118 if (mDeleteFilesOnRelease)
120 for (
unsigned i=0; i<mImages.size(); ++i)
134 if (index >= this->
size())
136 std::cout << QString(
"Attempt to call index %1, size=%2").arg(index).arg(this->
size()) << std::endl;
141 mImages[index]->purge();
147 return mImages[index]->getFilename();
153 return (
unsigned)mImages.size();
162 mOptionalWholeBase = image3D;
163 mImages.resize(image3D->GetDimensions()[2]);
165 for (
int i=0; i<mImages.size(); ++i)
169 import->SetImportVoidPointer(image3D->GetScalarPointer(0,0,i));
170 import->SetDataScalarType(image3D->GetScalarType());
171 import->SetDataSpacing(image3D->GetSpacing());
172 import->SetNumberOfScalarComponents(image3D->GetNumberOfScalarComponents());
178 import->SetWholeExtent(extent.data());
179 import->SetDataExtentToWholeExtent();
182 mImages[i] =
import->GetOutput();
192 return mImages[index];
197 return (
unsigned)mImages.size();
212 return mImages[index];
217 return mImages.size();
vtkImageDataPtr getImage()
#define CX_ASSERT(statement)
boost::shared_ptr< CachedImageData > CachedImageDataPtr
CachedImageDataContainer()
virtual QString getFilename(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
SplitFramesContainer(vtkImageDataPtr image3D)
virtual vtkImageDataPtr get(unsigned index)
FramesDataContainer(std::vector< vtkImageDataPtr > images)
Namespace for all CustusX production code.