Skip to content

Commit

Permalink
some basic cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
jabooth committed Apr 24, 2014
1 parent cd80fca commit 44f2e9d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 246 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"name": ""
"name": "",
"signature": "sha256:6f95af578bcf79cc58a71583ad23ac628bb5da163e0944e4ec6915799f295688"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand All @@ -11,7 +12,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"import menpo.io as pio"
"import menpo.io as mio"
],
"language": "python",
"metadata": {},
Expand All @@ -21,14 +22,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Before we get started, Menpo has a small cache of test assets shipped with it for example and testing purposes. You can get the filepath of this folder on your system easily"
"Menpo has a small cache of test assets shipped with it for example and testing purposes. You can get the filepath of this folder on your system easily"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data_dir = pio.data_dir_path()\n",
"data_dir = mio.data_dir_path()\n",
"print 'shipped data is at {}'.format(data_dir)\n",
"import os\n",
"os.listdir(data_dir)"
Expand All @@ -48,7 +49,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"builtin_assets = pio.ls_builtin_assets()\n",
"builtin_assets = mio.ls_builtin_assets()\n",
"print builtin_assets"
],
"language": "python",
Expand All @@ -66,7 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"bunny_path = pio.data_path_to('bunny.obj')\n",
"bunny_path = mio.data_path_to('bunny.obj')\n",
"print 'a bunny lives at {}'.format(bunny_path)"
],
"language": "python",
Expand Down Expand Up @@ -108,7 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"bunny = pio.import_mesh(bunny_path)\n",
"bunny = mio.import_mesh(bunny_path)\n",
"print bunny"
],
"language": "python",
Expand All @@ -119,7 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"%matplotlib wx\n",
"%matplotlib qt\n",
"bunny.view()"
],
"language": "python",
Expand All @@ -137,7 +138,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"same_bunny_less_hassle = pio.import_builtin_asset('bunny.obj')\n",
"same_bunny_less_hassle = mio.import_builtin_asset('bunny.obj')\n",
"print same_bunny_less_hassle"
],
"language": "python",
Expand All @@ -148,14 +149,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"All imported objects get stamped with the filepath. *Note that this API may change in time if we introduce a metadata dict on shapes - don't write code to rely on it's existance!*"
"All imported objects get stamped with a set of userful information - this can be found at the `ioinfo` attribute"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print 'this bunny came from {}'.format(bunny.filepath)"
"print bunny.ioinfo"
],
"language": "python",
"metadata": {},
Expand All @@ -174,7 +175,7 @@
"input": [
"%matplotlib inline\n",
"# builtin asset handles both images and meshes\n",
"takeo = pio.import_builtin_asset('takeo.ppm') \n",
"takeo = mio.import_builtin_asset('takeo.ppm') \n",
"takeo.view()"
],
"language": "python",
Expand All @@ -186,7 +187,7 @@
"collapsed": false,
"input": [
"%matplotlib inline\n",
"bb = pio.import_builtin_asset('breakingbad.jpg')\n",
"bb = mio.import_builtin_asset('breakingbad.jpg')\n",
"bb.view()"
],
"language": "python",
Expand Down Expand Up @@ -225,9 +226,9 @@
"collapsed": false,
"input": [
"%matplotlib inline\n",
"new_mexico = pio.data_path_to('breakingbad.jpg')\n",
"new_mexico = mio.data_path_to('breakingbad.jpg')\n",
"print 'Walter White lives at {}'.format(new_mexico)\n",
"walter_2 = pio.import_image(new_mexico)\n",
"walter_2 = mio.import_image(new_mexico)\n",
"walter_2.view() # exactly the same!"
],
"language": "python",
Expand All @@ -246,7 +247,7 @@
"collapsed": false,
"input": [
"try:\n",
" pio.import_image('/lol/I/bet/this/isnt/an/image/on/your/system.jpg')\n",
" mio.import_image('/lol/I/bet/this/isnt/an/image/on/your/system.jpg')\n",
"except ValueError as e:\n",
" print e"
],
Expand All @@ -268,9 +269,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
"all_data_files = pio.data_dir_path() + '/*'\n",
"all_data_files = mio.data_dir_path() + '/*'\n",
"print 'glob to find all inbuilt files: {}'.format(all_data_files)\n",
"for image in pio.import_images(all_data_files):\n",
"for image in mio.import_images(all_data_files):\n",
" print image"
],
"language": "python",
Expand All @@ -288,7 +289,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"images = list(pio.import_images(all_data_files))\n",
"images = list(mio.import_images(all_data_files))\n",
"print images"
],
"language": "python",
Expand All @@ -307,7 +308,7 @@
"collapsed": false,
"input": [
"cropped_images = []\n",
"for image in pio.import_images(all_data_files):\n",
"for image in mio.import_images(all_data_files):\n",
" image.crop((0, 0), (100, 100))\n",
" cropped_images.append(image)\n",
"for image in cropped_images:\n",
Expand All @@ -328,7 +329,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"for mesh in pio.import_meshes(all_data_files):\n",
"for mesh in mio.import_meshes(all_data_files):\n",
" print mesh\n",
"# note there is only one mesh in the data file at present!"
],
Expand All @@ -347,7 +348,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"for asset in pio.import_auto(all_data_files):\n",
"for asset in mio.import_auto(all_data_files):\n",
" print asset"
],
"language": "python",
Expand All @@ -358,4 +359,4 @@
"metadata": {}
}
]
}
}
115 changes: 0 additions & 115 deletions notebooks/TriMeshCorresponder.ipynb

This file was deleted.

Loading

0 comments on commit 44f2e9d

Please sign in to comment.