Posts

Showing posts from November, 2017

Simplistic boundary voxelization of a triangulated surface (stl-to-voxel)

The python code blow illustrates a simplistic concept of how to convert a triangulates surface into a voxel (image stack) representation.This code is not optimized for speed rather than having a clear structure to better understand the individual steps of this algorithm.

Create a Random (Beep) Melody

The script below demonstrates how to create a random (beep) melody with python and the winsound module. Well, it is not a great composer tool and will probably annoy the heck out of you, but give it a try:

Create a Random Image

The script below uses numpy and scipy functions to create a random image just like the one in the background of this blog.

A Convenient Way of Image Processing with Numpy Arrays

If you are looking for a convenient way to process images via numpy arrays, then there is good news because there are already python tools in place allowing you to do that. Before you can get started you need: A working python installation. I use Python36 . A numpy package installation which you can easily install by typing pip install numpy in a command shell on windows. The python scipy package which can be installed with pip as well by typing  pip install scipy in a   command shell. And lastly you need the image processing package Pillow which can also be obtained and installed via command shell by typing  pip install Pillow. Once you have completed the points above, then you can use the scipy.misc module to process images by treating them as numpy arrays. To start you off with, a great collection of examples can be found here .

Installing and Using Fortran To Python (F2PY) Interface Generator

This post provides you  info for installing and using the Fortran to Python ( f2py ) interface generator on windows. f2py is part of the numpy package allows you to connect Python and Fortran languages mainly with the intention to benefit from Fortran's performance. To get f2py to work on windows x64 with a python 3.6 installation, you need to do the following: If you have not done this already, download and install python36 I like to install python under C:\Python36\ rather than the default location. Also, make sure you check the boxes for adding python to your environment variables Install numpy  by using python's pip command. Open a command shell and type pip install numpy which will start the installation of Python's numerical package including the f2py interface. Install a Fortran compiler in order to compile code to combine it with Python. There is no default compiler that is shipped with either Python or numpy and therefore needs to be downloaded and ins...