35 #include "vtkImageData.h" 73 return QString(
"%1/%2").arg(root).arg(suffix);
90 QString unique_string =
qstring_cast(reinterpret_cast<long>(vtkImageData.GetPointer()));
91 QString imagesUid = QString(
"TESTUID_%2_%1").arg(unique_string);
100 std::vector<cx::ImagePtr> retval;
101 for (
unsigned i=0; i<count; ++i)
104 retval.push_back(image);
114 unsigned char* ptr =
reinterpret_cast<unsigned char*
>(image->GetScalarPointer());
115 unsigned int pixelCount = 0;
116 for (
unsigned i = 0; i < image->GetDimensions()[0]*image->GetDimensions()[1]*image->GetDimensions()[2]; ++i)
118 if (ptr[i*image->GetNumberOfScalarComponents()+component] > threshold)
132 Eigen::Array3i dim(image->GetDimensions());
133 unsigned int totalPixels = dim[0]*dim[1]*dim[2];
136 return double(hits)/double(totalPixels);
QString qstring_cast(const T &val)
boost::shared_ptr< class Image > ImagePtr
static std::vector< cx::ImagePtr > create3DImages(unsigned int imageCount, Eigen::Array3i dim=Eigen::Array3i(3, 3, 3), const unsigned int voxelValue=100)
static cx::ImagePtr create3DImage(Eigen::Array3i dim=Eigen::Array3i(3, 3, 3), const unsigned int voxelValue=100)
static void sleep_sec(int seconds)
static double getFractionOfVoxelsAboveThreshold(vtkImageDataPtr image, int threshold, int component=0)
static QString getTestDataPath()
return path to test data folder
vtkImageDataPtr generateVtkImageData(Eigen::Array3i dim, Vector3D spacing, const unsigned char initValue, int components)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
static unsigned int getNumberOfVoxelsAboveThreshold(vtkImageDataPtr image, int threshold, int component=0)
static QString getDataRoot(QString suffix="")
static unsigned int getNumberOfNonZeroVoxels(vtkImageDataPtr image)
static vtkImageDataPtr create3DVtkImageData(Eigen::Array3i dim=Eigen::Array3i(3, 3, 3), const unsigned int voxelValue=100)