Skip to content

Instantly share code, notes, and snippets.

@daviddoria
daviddoria / FastMarchingSimple.cxx
Created February 18, 2011 15:46
An example of the level of simplicity that should be available.
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include "itkPolyLineParametricPath.h"
#include "itkSpeedFunctionToPathFilter.h"
#include "itkPathIterator.h"
#include "itkGradientDescentOptimizer.h"
#include "itkSigmoidImageFilter.h"
int vtkImageData::ComputeStructuredCoordinates( const double x[3], int ijk[3], double pcoords[3],
const int* extent,
const double* spacing,
const double* origin,
const double* bounds)
{
// tolerance is needed for 2D data (this is squared tolerance)
const double tol2 = 1e-12;
//
// Compute the ijk location
@daviddoria
daviddoria / .bashrc
Created April 29, 2015 19:35
Environment files
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
----------------------------------------------------------------------
-- This script demonstrates how to define a couple of different
-- models:
-- + 2-layer neural network (MLP)
--
----------------------------------------------------------------------
require 'torch' -- torch
require 'nn' -- provides all sorts of trainable modules/layers
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy
hl, = plt.plot([], [])
#plt.show()
def update_line(hl, new_data):
hl.set_xdata(numpy.append(hl.get_xdata(), new_data))
hl.set_ydata(numpy.append(hl.get_ydata(), new_data))
#include <iostream>
struct Point
{
public:
double x,y,z;
};
// A mixin to add an 'A' value to a point
template<class Base>
#ifndef ABSTRACT_POINT_H
#define ABSTRACT_POINT_H
#include <boost/serialization/export.hpp>
class AbstractPoint
{
public:
virtual ~AbstractPoint(){}
virtual void DoSomething() = 0;
#include "AbstractPoint.h"
BOOST_CLASS_EXPORT_IMPLEMENT(AbstractPoint)
#include "AbstractPoint.h"
//BOOST_CLASS_EXPORT_IMPLEMENT(AbstractPoint)
#include <iostream>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
typedef boost::property<boost::edge_weight_t, double> EdgeWeightProperty;
/*
adjacency_list<OutEdgeList, VertexList, Directed,
VertexProperties, EdgeProperties,