本文整理汇总了C++中image::pointer::updateModifiedTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::updateModifiedTimestamp方法的具体用法?C++ pointer::updateModifiedTimestamp怎么用?C++ pointer::updateModifiedTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::pointer
的用法示例。
在下文中一共展示了pointer::updateModifiedTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void DoubleFilter::execute() {
if(!mInput.isValid()) {
throw Exception("No input supplied to GaussianSmoothingFilter");
}
Image::pointer input = mInput;
Image::pointer output = mOutput;
// Initialize output image
output->createFromImage(input, mDevice);
if(mDevice->isHost()) {
// Execution device is Host, use the executeAlgorithmOnHost function with the given data type
switch(input->getDataType()) {
// This macro creates a case statement for each data type and sets FAST_TYPE to the correct C++ data type
fastSwitchTypeMacro(executeAlgorithmOnHost<FAST_TYPE>(input, output));
}
} else {
// Execution device is an OpenCL device
OpenCLDevice::pointer device = boost::static_pointer_cast<OpenCLDevice>(mDevice);
// Set build options based on the data type of the data
std::string buildOptions = "";
switch(input->getDataType()) {
case TYPE_FLOAT:
buildOptions = "-DTYPE=float";
break;
case TYPE_INT8:
buildOptions = "-DTYPE=char";
break;
case TYPE_UINT8:
buildOptions = "-DTYPE=uchar";
break;
case TYPE_INT16:
buildOptions = "-DTYPE=short";
break;
case TYPE_UINT16:
buildOptions = "-DTYPE=ushort";
break;
}
// Compile the code
int programNr = device->createProgramFromSource(std::string(FAST_SOURCE_DIR) + "Tests/Algorithms/DoubleFilter.cl", buildOptions);
cl::Kernel kernel = cl::Kernel(device->getProgram(programNr), "doubleFilter");
// Get global size for the kernel
cl::NDRange globalSize(input->getWidth()*input->getHeight()*input->getDepth()*input->getNrOfComponents());
// Set the arguments for the kernel
OpenCLBufferAccess inputAccess = input->getOpenCLBufferAccess(ACCESS_READ, device);
OpenCLBufferAccess outputAccess = output->getOpenCLBufferAccess(ACCESS_READ_WRITE, device);
kernel.setArg(0, *inputAccess.get());
kernel.setArg(1, *outputAccess.get());
// Execute the kernel
device->getCommandQueue().enqueueNDRangeKernel(
kernel,
cl::NullRange,
globalSize,
cl::NullRange
);
}
// Update timestamp of the output data
output->updateModifiedTimestamp();
}