Skip to content

Commit

Permalink
ENH: Merged with master .
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Jul 25, 2011
2 parents a055404 + 40fc754 commit e8fc23f
Show file tree
Hide file tree
Showing 4 changed files with 887 additions and 198 deletions.
33 changes: 20 additions & 13 deletions antsSCCANObject.h
Expand Up @@ -84,10 +84,10 @@ class ITK_EXPORT antsSCCANObject :
/** ivars Set/Get functionality */
itkSetMacro( MaximumNumberOfIterations, unsigned int );
itkGetConstMacro( MaximumNumberOfIterations, unsigned int );
itkSetMacro( MinClusterSize, unsigned int );
itkGetConstMacro( MinClusterSize, unsigned int );
// itkSetMacro( MinClusterSizeQ, unsigned int );
// itkGetConstMacro( MinClusterSizeQ, unsigned int );
itkSetMacro( MinClusterSizeP, unsigned int );
itkGetConstMacro( MinClusterSizeP, unsigned int );
itkSetMacro( MinClusterSizeQ, unsigned int );
itkGetConstMacro( MinClusterSizeQ, unsigned int );
itkSetMacro( KeptClusterSize, unsigned int );
itkGetConstMacro( KeptClusterSize, unsigned int );
itkSetMacro( AlreadyWhitened, bool );
Expand All @@ -99,7 +99,7 @@ class ITK_EXPORT antsSCCANObject :
itkSetMacro( SCCANFormulation, SCCANFormulationType );
itkGetConstMacro( SCCANFormulation, SCCANFormulationType );

void NormalizeWeightsByCovariance();
void NormalizeWeightsByCovariance(unsigned int);
void WhitenDataSetForRunSCCANMultiple(unsigned int nvecs=0);
void SetPseudoInversePercentVariance( RealType p ) { this->m_PercentVarianceForPseudoInverse=p; }

Expand Down Expand Up @@ -185,7 +185,8 @@ class ITK_EXPORT antsSCCANObject :

itkSetMacro( FractionNonZeroQ, RealType );
itkSetMacro( KeepPositiveQ, bool );
itkGetMacro( KeepPositiveQ, bool );
itkGetMacro( KeepPositiveQ, bool );

void SetMaskImageQ( ImagePointer mask ) { this->m_MaskImageQ=mask; }
void SetMatrixQ( MatrixType matrix ) { this->m_OriginalMatrixQ.set_size(matrix.rows(),matrix.cols()); this->m_MatrixQ.set_size(matrix.rows(),matrix.cols()); this->m_OriginalMatrixQ.update(matrix); this->m_MatrixQ.update(matrix);}

Expand All @@ -205,7 +206,7 @@ class ITK_EXPORT antsSCCANObject :
RealType RunSCCAN2( );
RealType RunSCCAN3();

VectorType SoftThreshold( VectorType v_in, RealType fractional_goal , bool allow_negative_weights );
void ReSoftThreshold( VectorType& v_in, RealType fractional_goal , bool allow_negative_weights );
VectorType InitializeV( MatrixType p );
MatrixType NormalizeMatrix(MatrixType p);
/** needed for partial scca */
Expand All @@ -225,8 +226,11 @@ class ITK_EXPORT antsSCCANObject :
}

MatrixType WhitenMatrix(MatrixType p, RealType regularization=1.e-2 ) {
MatrixType invcov=this->CovarianceMatrix(p,regularization);
invcov=this->PseudoInverse( invcov, true );
double reg=1.e-8;
if ( p.rows() < p.cols() ) reg=regularization;
MatrixType cov=this->CovarianceMatrix(p,reg);
MatrixType invcov=this->PseudoInverse( cov, true );
// std::cout << invcov*cov << std::endl; exit(0);
if ( p.rows() < p.columns() ) return (invcov*p);
else return p*invcov;
}
Expand Down Expand Up @@ -278,9 +282,12 @@ class ITK_EXPORT antsSCCANObject :

RealType SparseCCA(unsigned int nvecs);
RealType SparsePartialCCA(unsigned int nvecs);
RealType SparsePartialArnoldiCCA(unsigned int nvecs);
RealType SparseArnoldiSVD(unsigned int nvecs);

protected:

void SortResults(unsigned int n_vecs);
// for pscca
void UpdatePandQbyR( );

Expand Down Expand Up @@ -371,8 +378,8 @@ class ITK_EXPORT antsSCCANObject :

private:

ImagePointer ConvertVariateToSpatialImage( VectorType variate, ImagePointer mask );
VectorType ClusterThresholdVariate( VectorType, ImagePointer mask );
ImagePointer ConvertVariateToSpatialImage( VectorType variate, ImagePointer mask , bool threshold_at_zero=false );
VectorType ClusterThresholdVariate( VectorType&, ImagePointer mask , unsigned int);

bool m_Debug;
MatrixType m_OriginalMatrixP;
Expand Down Expand Up @@ -423,8 +430,8 @@ class ITK_EXPORT antsSCCANObject :
bool m_SpecializationForHBM2011;
RealType m_CorrelationForSignificanceTest;

unsigned int m_MinClusterSize;
// unsigned int m_MinClusterSizeQ;
unsigned int m_MinClusterSizeP;
unsigned int m_MinClusterSizeQ;
unsigned int m_KeptClusterSize;

};
Expand Down

0 comments on commit e8fc23f

Please sign in to comment.