本文整理汇总了C++中mitk::image::Pointer::GetChannelData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetChannelData方法的具体用法?C++ Pointer::GetChannelData怎么用?C++ Pointer::GetChannelData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::image::Pointer
的用法示例。
在下文中一共展示了Pointer::GetChannelData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Equal_ContentOfIGTLImageMessageAndMitkImage_True
/**
* This test takes a generated gradient mitk image. Then an IGTL Message is produced
* using the ImageToIGTLMessageFilter. In the end it is tested, wether the image data in both images is equivalent.
*/
void Equal_ContentOfIGTLImageMessageAndMitkImage_True(unsigned int dim)
{
m_TestImage = mitk::ImageGenerator::GenerateGradientImage<unsigned char>(dim, dim, 1u);
m_ImageToIGTLMessageFilter->SetInput(m_TestImage);
m_ImageToIGTLMessageFilter->GenerateData();
mitk::IGTLMessage::Pointer resultMessage = m_ImageToIGTLMessageFilter->GetOutput();
CPPUNIT_ASSERT_MESSAGE("Output of ImageToIGTLMessageFilter was null", resultMessage != nullptr);
igtl::MessageBase::Pointer msgBase = resultMessage->GetMessage();
igtl::ImageMessage* igtlImageMessage = (igtl::ImageMessage*)(msgBase.GetPointer());
CPPUNIT_ASSERT_MESSAGE("Output of ImageToIGTLMessageFilter was not of type igtl::ImageMessage", igtlImageMessage != nullptr);
const void* outputBuffer = igtlImageMessage->GetScalarPointer();
CPPUNIT_ASSERT_MESSAGE("Output Buffer was null", outputBuffer != nullptr);
mitk::ImageReadAccessor readAccess(m_TestImage, m_TestImage->GetChannelData(0));
const void* inputBuffer = readAccess.GetData();
CPPUNIT_ASSERT_MESSAGE("Input Buffer was null", inputBuffer != nullptr);
CPPUNIT_ASSERT_MESSAGE("Images were not identical", memcmp(inputBuffer, outputBuffer, dim*dim) == 0);
}