This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size_t found = m_FilePath.find_last_of("/\\"); | |
m_FileDir = str.substr(0,found); | |
m_FileName = str.substr(found+1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute -G arg for configuring external projects with the same CMake generator: | |
if(CMAKE_EXTRA_GENERATOR) | |
set(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") | |
else() | |
set(gen "${CMAKE_GENERATOR}") | |
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=> MODIFICATIONS | |
/* In CSolverFactory.h */ | |
+ #include "CSolverStepLengthSelection.h" | |
+ typedef CSolverStepLengthSelection< TState > SolverStepLengthSelection; | |
+ enum NumericSolverType {StepLengthSelection, LineSearchUnconstrained, LineSearchConstrained, IpOpt, LBFGS, NLOPT }; | |
- enum NumericSolverType {LineSearchUnconstrained, LineSearchConstrained, IpOpt, LBFGS, NLOPT }; | |
/* In CSolverFactory.txx */ | |
CSolverFactory< TState >::CreateNewSolver( NumericSolverType solver ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef C_SOLVER_STEP_LENGTH_SELECTION_H | |
#define C_SOLVER_STEP_LENGTH_SELECTION_H | |
#include "CALATKCommon.h" | |
#include "CObjectiveFunction.h" | |
#include "CSolver.h" | |
namespace CALATK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef C_SOLVER_STEP_LENGTH_SELECTION_TXX | |
#define C_SOLVER_STEP_LENGTH_SELECTION_TXX | |
template < class TState > | |
CSolverStepLengthSelection< TState>::CSolverStepLengthSelection() | |
: DefaultMinGradAllowed( 0.0001 ), | |
DefaultMinDisplacementAllowed( 0.001 ), | |
DefaultDecreaseConstant( 0.0001 ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M1 = [alpha_prev^2, -alpha_cur^2; -alpha_prev^3, alpha_cur^3]; | |
M2 = [phi_alpha - phi_0 - phiP_0*alpha_cur; phi_prev - phi_0 - phiP_0*alpha_prev]; | |
M = M1 * M2 * 1/(alpha_prev^2 * alpha_cur^2 * (alpha_cur - alpha_prev)); | |
a = M(1); | |
b = M(2); | |
alpha = (-b + sqrt(b*b - 3*a*phiP_0))/(3*a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PolyData | |
ShapePopulationData * Mesh = new ShapePopulationData; | |
Mesh->ReadMesh(a_filePath); | |
m_meshList.push_back(Mesh); | |
//Polydata Mapper | |
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); | |
#if (VTK_MAJOR_VERSION < 6) | |
mapper->SetInputConnection(Mesh->GetPolyData()->GetProducerPort()); | |
#else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// to ITK 3D | |
// | |
template <class T, unsigned int VImageDimension > | |
typename DeformationImageType::Pointer VectorImageUtils< T, VImageDimension >::convertToITK( const VectorImageType3D* im) | |
{ | |
/* DeformationImageType instead of ITKVectorImage<T,VImageDimension>::Type | |
** | |
** We defined DeformationImageType like this in VectorImageUtils.h : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, unsigned int VImageDimension > | |
void VectorImageUtils< T, VImageDimension >::HFieldToDeformationFieldImageFilter(typename DeformationImageType::Pointer itkImage) | |
{ | |
ImageRegionConstIteratorWithIndex<DeformationImageType> it = ImageRegionConstIteratorWithIndex<DeformationImageType>( | |
itkImage, itkImage->GetRequestedRegion()); | |
for(it.GoToBegin();!it.IsAtEnd(); ++it) | |
{ | |
typename DeformationImageType::PixelType displacementValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [histout,costdata, x] = linesearch(x0,f,g,tolPos,tolGrad,maxit) | |
% LINESEARCH finds the minimum of an objective function using | |
% - Steepest descent Algorithm | |
% - Armijo as a condition for sufficient decrease (could try Wolf?) | |
% - Step length selection | |
% | |
% INPUT: | |
% - x0 = initial iterate position | |
% - f = objective function, | |
% - g = grad f (COLUMN vector) |
OlderNewer