本文整理汇总了C++中typenameimagetype::Pointer::IsNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::IsNull方法的具体用法?C++ Pointer::IsNull怎么用?C++ Pointer::IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenameimagetype::Pointer
的用法示例。
在下文中一共展示了Pointer::IsNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBackCasting
int testBackCasting(mitk::Image* imgMem, typename ImageType::Pointer & itkImage, bool disconnectAfterImport)
{
int result;
if(itkImage.IsNull())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
int *p = (int*)itkImage->GetBufferPointer();
if(p==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing mitk::CastToMitkImage: " << std::flush;
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitk::CastToMitkImage( itkImage, mitkImage );
std::cout<<"[PASSED]"<<std::endl;
result = compareGeometries(imgMem->GetGeometry(), mitkImage->GetGeometry());
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing whether data after mitk::CastToMitkImage is available: " << std::flush;
if(mitkImage->IsChannelSet()==false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing mitk::ImportItkImage: " << std::flush;
mitkImage = mitk::ImportItkImage(itkImage);
std::cout<<"[PASSED]"<<std::endl;
if(disconnectAfterImport)
{
std::cout << "Testing DisconnectPipeline() on mitk::Image into which was imported : " << std::flush;
mitkImage->DisconnectPipeline();
std::cout<<"[PASSED]"<<std::endl;
}
result = compareGeometries(imgMem->GetGeometry(), mitkImage->GetGeometry());
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing whether data after mitk::ImportItkImage is available: " << std::flush;
if(mitkImage->IsChannelSet()==false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
return EXIT_SUCCESS;
}
示例2: eigenanatomyCppHelper
SEXP eigenanatomyCppHelper(
NumericMatrix X,
SEXP r_mask,
RealType sparseness,
IntType nvecs,
IntType its,
IntType cthresh,
RealType z,
RealType smooth,
// NumericMatrix initializationMatrix,
Rcpp::List initializationList,
IntType covering,
RealType ell1,
IntType verbose,
IntType powerit,
RealType priorWeight )
{
enum { Dimension = ImageType::ImageDimension };
typename ImageType::RegionType region;
typedef typename ImageType::PixelType PixelType;
typedef typename ImageType::Pointer ImagePointerType;
typedef double Scalar;
typedef itk::ants::antsSCCANObject<ImageType, Scalar> SCCANType;
typedef typename SCCANType::MatrixType vMatrix;
typename SCCANType::Pointer sccanobj = SCCANType::New();
typename ImageType::Pointer mask = Rcpp::as<ImagePointerType>( r_mask );
bool maskisnull = mask.IsNull();
// deal with the initializationList, if any
unsigned int nImages = initializationList.size();
if ( ( nImages > 0 ) && ( !maskisnull ) )
{
itk::ImageRegionIteratorWithIndex<ImageType> it( mask,
mask->GetLargestPossibleRegion() );
vMatrix priorROIMat( nImages , X.cols() );
priorROIMat.fill( 0 );
for ( unsigned int i = 0; i < nImages; i++ )
{
typename ImageType::Pointer init =
Rcpp::as<ImagePointerType>( initializationList[i] );
unsigned long ct = 0;
it.GoToBegin();
while ( !it.IsAtEnd() )
{
PixelType pix = it.Get();
if ( pix >= 0.5 )
{
pix = init->GetPixel( it.GetIndex() );
priorROIMat( i, ct ) = pix;
ct++;
}
++it;
}
}
sccanobj->SetMatrixPriorROI( priorROIMat );
nvecs = nImages;
}
sccanobj->SetPriorWeight( priorWeight );
sccanobj->SetLambda( priorWeight );
// cast hack from Rcpp type to sccan type
std::vector<double> xdat =
Rcpp::as< std::vector<double> >( X );
const double* _xdata = &xdat[0];
vMatrix vnlX( _xdata , X.cols(), X.rows() );
vnlX = vnlX.transpose();
sccanobj->SetGetSmall( false );
vMatrix priorROIMat;
// sccanobj->SetMatrixPriorROI( priorROIMat);
// sccanobj->SetMatrixPriorROI2( priorROIMat );
sccanobj->SetCovering( covering );
sccanobj->SetSilent( ! verbose );
if( ell1 > 0 )
{
sccanobj->SetUseL1( true );
}
else
{
sccanobj->SetUseL1( false );
}
sccanobj->SetGradStep( vnl_math_abs( ell1 ) );
sccanobj->SetMaximumNumberOfIterations( its );
sccanobj->SetRowSparseness( z );
sccanobj->SetSmoother( smooth );
if ( sparseness < 0 ) sccanobj->SetKeepPositiveP(false);
sccanobj->SetSCCANFormulation( SCCANType::PQ );
sccanobj->SetFractionNonZeroP( fabs( sparseness ) );
sccanobj->SetMinClusterSizeP( cthresh );
sccanobj->SetMatrixP( vnlX );
// sccanobj->SetMatrixR( r ); // FIXME
sccanobj->SetMaskImageP( mask );
RealType truecorr = 0;
if( powerit == 1 )
{
truecorr = sccanobj->SparseReconHome( nvecs );
}
else if ( priorWeight > 1.e-12 )
truecorr = sccanobj->SparseReconPrior( nvecs, true );
else truecorr = sccanobj->SparseRecon(nvecs);
//.........这里部分代码省略.........
示例3: sccanCppHelper
SEXP sccanCppHelper(
NumericMatrix X,
NumericMatrix Y,
SEXP r_maskx,
SEXP r_masky,
RealType sparsenessx,
RealType sparsenessy,
IntType nvecs,
IntType its,
IntType cthreshx,
IntType cthreshy,
RealType z,
RealType smooth,
Rcpp::List initializationListx,
Rcpp::List initializationListy,
IntType covering,
RealType ell1,
IntType verbose,
RealType priorWeight )
{
enum { Dimension = ImageType::ImageDimension };
typename ImageType::RegionType region;
typedef typename ImageType::PixelType PixelType;
typedef typename ImageType::Pointer ImagePointerType;
typedef double Scalar;
typedef itk::ants::antsSCCANObject<ImageType, Scalar> SCCANType;
typedef typename SCCANType::MatrixType vMatrix;
typename SCCANType::Pointer sccanobj = SCCANType::New();
typename ImageType::Pointer maskx = Rcpp::as<ImagePointerType>( r_maskx );
typename ImageType::Pointer masky = Rcpp::as<ImagePointerType>( r_masky );
bool maskxisnull = maskx.IsNull();
bool maskyisnull = masky.IsNull();
// deal with the initializationList, if any
unsigned int nImagesx = initializationListx.size();
if ( ( nImagesx > 0 ) && ( !maskxisnull ) )
{
itk::ImageRegionIteratorWithIndex<ImageType> it( maskx,
maskx->GetLargestPossibleRegion() );
vMatrix priorROIMatx( nImagesx , X.cols() );
priorROIMatx.fill( 0 );
for ( unsigned int i = 0; i < nImagesx; i++ )
{
typename ImageType::Pointer init =
Rcpp::as<ImagePointerType>( initializationListx[i] );
unsigned long ct = 0;
it.GoToBegin();
while ( !it.IsAtEnd() )
{
PixelType pix = it.Get();
if ( pix >= 0.5 )
{
pix = init->GetPixel( it.GetIndex() );
priorROIMatx( i, ct ) = pix;
ct++;
}
++it;
}
}
sccanobj->SetMatrixPriorROI( priorROIMatx );
nvecs = nImagesx;
}
unsigned int nImagesy = initializationListy.size();
if ( ( nImagesy > 0 ) && ( !maskyisnull ) )
{
itk::ImageRegionIteratorWithIndex<ImageType> it( masky,
masky->GetLargestPossibleRegion() );
vMatrix priorROIMaty( nImagesy , Y.cols() );
priorROIMaty.fill( 0 );
for ( unsigned int i = 0; i < nImagesy; i++ )
{
typename ImageType::Pointer init =
Rcpp::as<ImagePointerType>( initializationListy[i] );
unsigned long ct = 0;
it.GoToBegin();
while ( !it.IsAtEnd() )
{
PixelType pix = it.Get();
if ( pix >= 0.5 )
{
pix = init->GetPixel( it.GetIndex() );
priorROIMaty( i, ct ) = pix;
ct++;
}
++it;
}
}
sccanobj->SetMatrixPriorROI2( priorROIMaty );
nvecs = nImagesy;
}
sccanobj->SetPriorWeight( priorWeight );
sccanobj->SetLambda( priorWeight );
// cast hack from Rcpp type to sccan type
std::vector<double> xdat =
Rcpp::as< std::vector<double> >( X );
const double* _xdata = &xdat[0];
vMatrix vnlX( _xdata , X.cols(), X.rows() );
vnlX = vnlX.transpose();
//.........这里部分代码省略.........