本文整理汇总了C++中image::Pointer::SetChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetChannel方法的具体用法?C++ Pointer::SetChannel怎么用?C++ Pointer::SetChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::Pointer
的用法示例。
在下文中一共展示了Pointer::SetChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mitkIpPicNew
void mitk::PicFileReader::FillImage(Image::Pointer output)
{
mitkIpPicDescriptor *outputPic = mitkIpPicNew();
outputPic = CastToIpPicDescriptor(output, nullptr, outputPic);
mitkIpPicDescriptor *pic = mitkIpPicGet(const_cast<char *>(this->GetLocalFileName().c_str()), outputPic);
// comes upside-down (in MITK coordinates) from PIC file
ConvertHandedness(pic);
mitkIpPicTSV_t *tsv;
if ((tsv = mitkIpPicQueryTag(pic, "SOURCE HEADER")) != NULL)
{
if (tsv->n[0] > 1e+06)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag(pic, "SOURCE HEADER");
mitkIpPicFreeTag(tsvSH);
}
}
if ((tsv = mitkIpPicQueryTag(pic, "ICON80x80")) != NULL)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag(pic, "ICON80x80");
mitkIpPicFreeTag(tsvSH);
}
if ((tsv = mitkIpPicQueryTag(pic, "VELOCITY")) != NULL)
{
mitkIpPicDescriptor *header = mitkIpPicCopyHeader(pic, NULL);
header->data = tsv->value;
ConvertHandedness(header);
output->SetChannel(header->data, 1);
header->data = NULL;
mitkIpPicFree(header);
mitkIpPicDelTag(pic, "VELOCITY");
}
// Copy the memory to avoid mismatches of malloc() and delete[].
// mitkIpPicGet will always allocate a new memory block with malloc(),
// but MITK Images delete the data via delete[].
output->SetImportChannel(pic->data, 0, Image::CopyMemory);
pic->data = nullptr;
mitkIpPicFree(pic);
}
示例2: ImageFileReaderException
void mitk::PicFileReader::GenerateData()
{
Image::Pointer output = this->GetOutput();
// Check to see if we can read the file given the name or prefix
//
if ( m_FileName == "" && m_FilePrefix == "" )
{
throw itk::ImageFileReaderException(__FILE__, __LINE__, "One of FileName or FilePrefix must be non-empty");
}
if( m_FileName != "")
{
mitkIpPicDescriptor* outputPic = mitkIpPicNew();
outputPic = CastToIpPicDescriptor(output, outputPic);
mitkIpPicDescriptor* pic=MITKipPicGet(const_cast<char *>(m_FileName.c_str()),
outputPic);
// comes upside-down (in MITK coordinates) from PIC file
ConvertHandedness(pic);
mitkIpPicTSV_t *tsv;
if ( (tsv = mitkIpPicQueryTag( pic, "SOURCE HEADER" )) != NULL)
{
if(tsv->n[0]>1e+06)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag( pic, "SOURCE HEADER" );
mitkIpPicFreeTag(tsvSH);
}
}
if ( (tsv = mitkIpPicQueryTag( pic, "ICON80x80" )) != NULL)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag( pic, "ICON80x80" );
mitkIpPicFreeTag(tsvSH);
}
if ( (tsv = mitkIpPicQueryTag( pic, "VELOCITY" )) != NULL)
{
mitkIpPicDescriptor* header = mitkIpPicCopyHeader(pic, NULL);
header->data = tsv->value;
ConvertHandedness(header);
output->SetChannel(header->data, 1);
header->data = NULL;
mitkIpPicFree(header);
mitkIpPicDelTag( pic, "VELOCITY" );
}
//slice-wise reading
//currently much too slow.
//else
//{
// int sstart, smax;
// int tstart, tmax;
// sstart=output->GetRequestedRegion().GetIndex(2);
// smax=sstart+output->GetRequestedRegion().GetSize(2);
// tstart=output->GetRequestedRegion().GetIndex(3);
// tmax=tstart+output->GetRequestedRegion().GetSize(3);
// int s,t;
// for(s=sstart; s<smax; ++s)
// {
// for(t=tstart; t<tmax; ++t)
// {
// mitkIpPicDescriptor* pic=mitkIpPicGetSlice(const_cast<char *>(m_FileName.c_str()), NULL, t*smax+s+1);
// output->SetPicSlice(pic,s,t);
// }
// }
//}
}
else
{
int position;
mitkIpPicDescriptor* pic=NULL;
int zDim=(output->GetDimension()>2?output->GetDimensions()[2]:1);
printf("\n zdim is %u \n",zDim);
for (position = 0; position < zDim; ++position)
{
char fullName[1024];
sprintf(fullName, m_FilePattern.c_str(), m_FilePrefix.c_str(), m_StartFileIndex+position);
pic=MITKipPicGet(fullName, pic);
if(pic==NULL)
{
itkDebugMacro("Pic file '" << fullName << "' does not exist.");
}
/* FIXME else
if(output->SetPicSlice(pic, position)==false)
{
itkDebugMacro("Image '" << fullName << "' could not be added to Image.");
}*/
}
if(pic!=NULL)
mitkIpPicFree(pic);
}
}