本文整理汇总了C++中image::Pointer::IsInitialized方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::IsInitialized方法的具体用法?C++ Pointer::IsInitialized怎么用?C++ Pointer::IsInitialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::Pointer
的用法示例。
在下文中一共展示了Pointer::IsInitialized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void mitk::GeometryClipImageFilter::GenerateData()
{
Image::ConstPointer input = this->GetInput();
Image::Pointer output = this->GetOutput();
if((output->IsInitialized()==false) || (m_ClippingGeometry.IsNull()))
return;
const Geometry2D * clippingGeometryOfCurrentTimeStep = NULL;
if(m_TimeSlicedClippingGeometry.IsNull())
{
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_ClippingGeometry.GetPointer());
}
else
{
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_TimeSlicedClippingGeometry->GetGeometry3D(0));
}
if(clippingGeometryOfCurrentTimeStep == NULL)
return;
m_InputTimeSelector->SetInput(input);
m_OutputTimeSelector->SetInput(this->GetOutput());
mitk::Image::RegionType outputRegion = output->GetRequestedRegion();
const mitk::TimeSlicedGeometry *outputTimeGeometry = output->GetTimeSlicedGeometry();
const mitk::TimeSlicedGeometry *inputTimeGeometry = input->GetTimeSlicedGeometry();
ScalarType timeInMS;
int timestep=0;
int tstart=outputRegion.GetIndex(3);
int tmax=tstart+outputRegion.GetSize(3);
int t;
for(t=tstart;t<tmax;++t)
{
timeInMS = outputTimeGeometry->TimeStepToMS( t );
timestep = inputTimeGeometry->MSToTimeStep( timeInMS );
m_InputTimeSelector->SetTimeNr(timestep);
m_InputTimeSelector->UpdateLargestPossibleRegion();
m_OutputTimeSelector->SetTimeNr(t);
m_OutputTimeSelector->UpdateLargestPossibleRegion();
if(m_TimeSlicedClippingGeometry.IsNotNull())
{
timestep = m_TimeSlicedClippingGeometry->MSToTimeStep( timeInMS );
if(m_TimeSlicedClippingGeometry->IsValidTime(timestep) == false)
continue;
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_TimeSlicedClippingGeometry->GetGeometry3D(timestep));
}
AccessByItk_2(m_InputTimeSelector->GetOutput(),_InternalComputeClippedImage,this,clippingGeometryOfCurrentTimeStep);
}
m_TimeOfHeaderInitialization.Modified();
}
示例2: ImageFileReaderException
void mitk::PicFileReader::GenerateOutputInformation()
{
Image::Pointer output = this->GetOutput();
if ((output->IsInitialized()) && (this->GetMTime() <= m_ReadHeaderTime.GetMTime()))
return;
itkDebugMacro(<<"Reading file for GenerateOutputInformation()" << m_FileName);
// 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* header=mitkIpPicGetHeader(const_cast<char *>(m_FileName.c_str()), NULL);
if ( !header )
{
throw itk::ImageFileReaderException(__FILE__, __LINE__, "File could not be read.");
}
header=MITKipPicGetTags(const_cast<char *>(m_FileName.c_str()), header);
int channels = 1;
mitkIpPicTSV_t *tsv;
if ( (tsv = mitkIpPicQueryTag( header, "SOURCE HEADER" )) != NULL)
{
if(tsv->n[0]>1e+06)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag( header, "SOURCE HEADER" );
mitkIpPicFreeTag(tsvSH);
}
}
if ( (tsv = mitkIpPicQueryTag( header, "ICON80x80" )) != NULL)
{
mitkIpPicTSV_t *tsvSH;
tsvSH = mitkIpPicDelTag( header, "ICON80x80" );
mitkIpPicFreeTag(tsvSH);
}
if ( (tsv = mitkIpPicQueryTag( header, "VELOCITY" )) != NULL)
{
++channels;
mitkIpPicDelTag( header, "VELOCITY" );
}
if( header == NULL || header->bpe == 0)
{
itk::ImageFileReaderException e(__FILE__, __LINE__);
itk::OStringStream msg;
msg << " Could not read file "
<< m_FileName.c_str();
e.SetDescription(msg.str().c_str());
throw e;
return;
}
// First initialize the geometry of the output image by the pic-header
SlicedGeometry3D::Pointer slicedGeometry = mitk::SlicedGeometry3D::New();
PicHelper::InitializeEvenlySpaced(header, header->n[2], slicedGeometry);
// if pic image only 3D, the n[3] value is not initialized
unsigned int timesteps = 1;
if( header->dim > 3 )
timesteps = header->n[3];
TimeSlicedGeometry::Pointer timeSliceGeometry = TimeSlicedGeometry::New();
timeSliceGeometry->InitializeEvenlyTimed(slicedGeometry, timesteps);
timeSliceGeometry->ImageGeometryOn();
// Cast the pic descriptor to ImageDescriptor and initialize the output
output->Initialize( CastToImageDescriptor(header));
output->SetGeometry( timeSliceGeometry );
mitkIpPicFree ( header );
}
else
{
int numberOfImages=0;
m_StartFileIndex=0;
mitkIpPicDescriptor* header=NULL;
char fullName[1024];
while(m_StartFileIndex<10)
{
sprintf(fullName, m_FilePattern.c_str(), m_FilePrefix.c_str(), m_StartFileIndex+numberOfImages);
FILE * f=fopen(fullName,"r");
if(f==NULL)
{
//already found an image?
if(numberOfImages>0)
break;
//no? let's increase start
//.........这里部分代码省略.........