This file contains hidden or 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
#!/bin/bash | |
# Download MacOSX SDK and link them into XCode | |
# Make sure to update XCode beforehand (xcode-select --install) | |
mkdir SDKs | |
cd SDKs | |
git clone https://github.com/phracker/MacOSX-SDKs.git MacOSX.platform | |
cd .. | |
git clone https://gist.github.com/f213c737c0b2b581b13c.git |
This file contains hidden or 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
#!/usr/bin/python | |
# add-sdks.py | |
# Rob Napier <[email protected]> | |
# Alexis girault <[email protected]> | |
# Script to link in all your old SDKs to Xcode | |
# Needs to be run every time you update Xcode | |
# | |
# 1. Create a directory and store the SDKs: |
This file contains hidden or 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
// Enable OffScreen Rendering | |
renderWindow->OffScreenRenderingOn(); | |
// Set renderWindow size | |
const int* windowSize = renderWindow->GetSize(); | |
int W = windowSize[0]; | |
int H = windowSize[1]; | |
renderWindow->SetSize(d->exportWidthSpinBox->value(),d->exportHeightSpinBox->value()); | |
// Get Image |
This file contains hidden or 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
//-- Matrix | |
float modelview[16]; | |
float projection[16]; | |
glGetFloatv (GL_MODELVIEW_MATRIX, modelview); | |
glGetFloatv (GL_PROJECTION_MATRIX, projection); | |
cv::Mat modelM(4,4,CV_32FC2,modelview); | |
cv::Mat projM(4,4,CV_32FC2,projection); | |
cv::Mat M = projM*modelM; | |
std::cout<<M<<std::endl; |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 ), |