Firstly, define the tree
command as such:
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
The cd
to the directory in question and run tree
. You should get an output
such as this:
# Assuming that we have an object of type 'vtkImageData' under the name of | |
# 'image' | |
# Create a new vtkImageSliceMapper | |
mapper = vtk.vtkImageSliceMapper() | |
# Set 'image' as the input dataset | |
mapper.SetInput(image) | |
# Set the orthogonal slice orientation to be perpendicular to the 'X' axis. Use | |
# 'SetOrientationToY' and 'SetOrientationToZ' for the Y and Z axes. | |
# Alternatively you can use the 'SetOrientation' method with a 'int' parameter |
Firstly, define the tree
command as such:
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
The cd
to the directory in question and run tree
. You should get an output
such as this:
sources: | |
http://smh84.wordpress.com/2014/04/23/install-opencv-in-anaconda-1-9-2-on-mac-os-x-mavericks/ | |
https://gist.github.com/welch/6468594 | |
It is a rite of passage to post one's successful build instructions for OpenCV on a Mac | |
after you've tried all the other conflicting instructions out there and still failed. | |
brew failed for me (was this because I could never get a happy brew doctor situation? | |
I'll never know). macports? nope. build-from-source recipes? I didn't find one that | |
worked for me. | |
#!/usr/bin/python | |
import SimpleITK as sitk | |
import vtk | |
import numpy as np | |
from vtk.util.vtkConstants import * | |
def numpy2VTK(img,spacing=[1.0,1.0,1.0]): | |
# evolved from code from Stou S., |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from vtk import * | |
# Let's create a surface with 3 points unconnected. | |
points = vtkPoints() | |
points.InsertNextPoint(1, 0, 0) | |
points.InsertNextPoint(0, 0, 0) | |
points.InsertNextPoint(0, 1, 0) |
#!/usr/bin/env python | |
## | |
# This example shows how to apply an vtkImageData texture to an sphere | |
# vtkPolyData object. | |
# Note: Input jpg file can be located in the VTKData repository. | |
# | |
# @author JBallesteros | |
## |
# This example shows how to manually construct triangle cell using unstructured grids | |
# and display its surface normal. | |
# | |
package require vtk | |
package require vtkinteraction | |
# Create an unstructured grids containing a triangle cell. | |
vtkPoints trianglePoints | |
trianglePoints SetNumberOfPoints 3 |
import requests | |
def download_file(url): | |
local_filename = url.split('/')[-1] | |
# NOTE the stream=True parameter | |
r = requests.get(url, stream=True) | |
with open(local_filename, 'wb') as f: | |
for chunk in r.iter_content(chunk_size=1024): | |
if chunk: # filter out keep-alive new chunks | |
f.write(chunk) | |
f.flush() |
Here's how to use the os
module to get the directory of the file the command
is executed in
os.path.dirname(os.path.realpath(__file__))
From http://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory
This function takes a renderer and displays the output directly into IPython
def vtk_show(renderer, w=100, h=100):
"""
Takes vtkRenderer instance and returns an IPython Image with the rendering.
"""
renderWindow = vtkRenderWindow()
renderWindow.SetOffScreenRendering(1)
renderWindow.AddRenderer(renderer)