本文整理汇总了C++中mitk::image::Pointer::GetSliceData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetSliceData方法的具体用法?C++ Pointer::GetSliceData怎么用?C++ Pointer::GetSliceData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::image::Pointer
的用法示例。
在下文中一共展示了Pointer::GetSliceData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareImages
static bool CompareImages(mitk::Image::Pointer mitkImage, cv::Mat openCVImage)
{
float equal = true;
if (static_cast<int>(mitkImage->GetDimension(0)) != openCVImage.cols || static_cast<int>(mitkImage->GetDimension(1)) != openCVImage.rows)
{
equal = false;
}
mitk::ImagePixelReadAccessor<float,2> imageAcces(mitkImage, mitkImage->GetSliceData(0));
for(int i=0; i<openCVImage.cols; i++)
{
for(int j=0; j<openCVImage.rows; j++)
{
itk::Index<2> currentIndex;
currentIndex[0] = i;
currentIndex[1] = j;
float mitkImageValue = imageAcces.GetPixelByIndex(currentIndex);
float openCVImageValue = openCVImage.at<float>(j,i);
if (!mitk::Equal(mitkImageValue,openCVImageValue))
{
equal = false;
}
}
}
return equal;
}
示例2: CompareImages
static bool CompareImages(mitk::Image::Pointer image1, mitk::Image::Pointer image2)
{
//check if epsilon is exceeded
unsigned int sliceDimension = image1->GetDimension(0)*image1->GetDimension(1);
bool picturesEqual = true;
float* floatArray1 = (float*)image1->GetSliceData(0, 0, 0)->GetData();
float* floatArray2 = (float*)image2->GetSliceData(0, 0, 0)->GetData();
for(unsigned int i = 0; i < sliceDimension; i++)
{
if(!(mitk::Equal(floatArray1[i], floatArray2[i])))
{
picturesEqual = false;
}
}
return picturesEqual;
}
示例3: MapScalars
void ToFOpenCVImageGrabber::MapScalars( mitk::Image::Pointer mitkImage, IplImage* openCVImage)
{
unsigned int numOfPixel = m_ImageGrabber->GetCaptureWidth()*m_ImageGrabber->GetCaptureHeight();
float* floatData = (float*)mitkImage->GetSliceData(0, 0, 0)->GetData();
vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction = vtkColorTransferFunction::New();
vtkSmartPointer<vtkFloatArray> floatArrayInt;
floatArrayInt = vtkFloatArray::New();
floatArrayInt->Initialize();
floatArrayInt->SetArray(floatData, numOfPixel, 0);
mitk::ScalarType min = mitkImage->GetScalarValueMin();
mitk::ScalarType max = mitkImage->GetScalarValueMaxNoRecompute();
MITK_INFO<<"Minimum: "<<min;
MITK_INFO<<"Maximum: "<<max;
colorTransferFunction->RemoveAllPoints();
colorTransferFunction->AddRGBPoint(min, 0, 0, 0);
colorTransferFunction->AddRGBPoint(max, 1, 1, 1);
colorTransferFunction->SetColorSpaceToHSV();
//TODO other depth values
colorTransferFunction->MapScalarsThroughTable(floatArrayInt, (unsigned char*)openCVImage->imageData, VTK_LUMINANCE);
}
示例4: ReadPixel
void ReadPixel(mitk::PixelType, mitk::Image::Pointer image, itk::Index<3> indexPoint, double& value)
{
if (image->GetDimension() == 2)
{
mitk::ImagePixelReadAccessor<PixelType,2> readAccess(image, image->GetSliceData(0));
itk::Index<2> idx;
idx[0] = indexPoint[0];
idx[1] = indexPoint[1];
value = readAccess.GetPixelByIndex(idx);
}
else if (image->GetDimension() == 3)
{
mitk::ImagePixelReadAccessor<PixelType,3> readAccess(image, image->GetVolumeData(0));
itk::Index<3> idx;
idx[0] = indexPoint[0];
idx[1] = indexPoint[1];
idx[2] = indexPoint[2];
value = readAccess.GetPixelByIndex(idx);
}
else
{
//unhandled
}
}