{ "cells": [ { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# copy tree structure\n", "import os\n", "\n", "try:\n", " os.mkdir(os.path.join('./html'))\n", "except OSError:\n", " pass\n", "try:\n", " os.mkdir(os.path.join('./html/LABS'))\n", "except OSError:\n", " pass\n", "\n", "ld = os.listdir('.')\n", "\n", "chapters = [n for n in os.listdir('.') if '00'<= n <='99']\n", "for c in chapters:\n", " try:\n", " os.mkdir(os.path.join('./html',c))\n", " except OSError:\n", " pass\n", " \n", "labs = [n for n in os.listdir('./LABS/') if '00'<= n <='99']\n", "for c in labs:\n", " try:\n", " os.mkdir(os.path.join('./html/LABS',c))\n", " except OSError:\n", " pass" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "./05-Morphomathematics/04-Gray level morphology.ipynb ./html/05-Morphomathematics/04-Gray level morphology.html\n", "./05-Morphomathematics/02-Combined operations.ipynb ./html/05-Morphomathematics/02-Combined operations.html\n", "./05-Morphomathematics/content.ipynb ./html/05-Morphomathematics/content.html\n", "./05-Morphomathematics/01-Operators.ipynb ./html/05-Morphomathematics/01-Operators.html\n", "./05-Morphomathematics/03-The watershed transform.ipynb ./html/05-Morphomathematics/03-The watershed transform.html\n", "./01-Introduction/01-Biological vision.ipynb ./html/01-Introduction/01-Biological vision.html\n", "./01-Introduction/Untitled.ipynb ./html/01-Introduction/Untitled.html\n", "./01-Introduction/content.ipynb ./html/01-Introduction/content.html\n", "./01-Introduction/03-Digital image.ipynb ./html/01-Introduction/03-Digital image.html\n", "./01-Introduction/02-Image sensors.ipynb ./html/01-Introduction/02-Image sensors.html\n", "./10-Object recognition/content.ipynb ./html/10-Object recognition/content.html\n", "./06-Object feature extraction/01-Statistical features.ipynb ./html/06-Object feature extraction/01-Statistical features.html\n", "./06-Object feature extraction/03-Moments.ipynb ./html/06-Object feature extraction/03-Moments.html\n", "./06-Object feature extraction/02-Contour features.ipynb ./html/06-Object feature extraction/02-Contour features.html\n", "./06-Object feature extraction/04-Texture features.ipynb ./html/06-Object feature extraction/04-Texture features.html\n", "./06-Object feature extraction/texture analysis example.ipynb ./html/06-Object feature extraction/texture analysis example.html\n", "./06-Object feature extraction/content.ipynb ./html/06-Object feature extraction/content.html\n", "./00-Preface/05-Practical works.ipynb ./html/00-Preface/05-Practical works.html\n", "./00-Preface/06-References.ipynb ./html/00-Preface/06-References.html\n", "./00-Preface/content.ipynb ./html/00-Preface/content.html\n", "./00-Preface/04-Bokeh plots.ipynb ./html/00-Preface/04-Bokeh plots.html\n", "./00-Preface/01-Aims.ipynb ./html/00-Preface/01-Aims.html\n", "./00-Preface/02-Integration.ipynb ./html/00-Preface/02-Integration.html\n", "./00-Preface/03-Get involved.ipynb ./html/00-Preface/03-Get involved.html\n", "./08-Vision/content.ipynb ./html/08-Vision/content.html\n", "./03-Basic image analysis/01-Image processing chain.ipynb ./html/03-Basic image analysis/01-Image processing chain.html\n", "./03-Basic image analysis/content.ipynb ./html/03-Basic image analysis/content.html\n", "./07-Model-based segmentation/content.ipynb ./html/07-Model-based segmentation/content.html\n", "./04-Image segmentation/01-Histogram based image segmentation.ipynb ./html/04-Image segmentation/01-Histogram based image segmentation.html\n", "./04-Image segmentation/04-Model-based segmentation.ipynb ./html/04-Image segmentation/04-Model-based segmentation.html\n", "./04-Image segmentation/02-Border-based segmentation.ipynb ./html/04-Image segmentation/02-Border-based segmentation.html\n", "./04-Image segmentation/05-Examples.ipynb ./html/04-Image segmentation/05-Examples.html\n", "./04-Image segmentation/content.ipynb ./html/04-Image segmentation/content.html\n", "./04-Image segmentation/03-Region based segmentation.ipynb ./html/04-Image segmentation/03-Region based segmentation.html\n", "./09-Object tracking/content.ipynb ./html/09-Object tracking/content.html\n", "./02-Low-level image processing/02-Linear filtering.ipynb ./html/02-Low-level image processing/02-Linear filtering.html\n", "./02-Low-level image processing/05-Edge detection.ipynb ./html/02-Low-level image processing/05-Edge detection.html\n", "./02-Low-level image processing/content.ipynb ./html/02-Low-level image processing/content.html\n", "./02-Low-level image processing/01-Point processing.ipynb ./html/02-Low-level image processing/01-Point processing.html\n", "./02-Low-level image processing/03-Non linear filtering.ipynb ./html/02-Low-level image processing/03-Non linear filtering.html\n", "./02-Low-level image processing/04-Image restoration.ipynb ./html/02-Low-level image processing/04-Image restoration.html\n", "./LABS/00-readme/content.ipynb ./html/LABS/00-readme/content.html\n", "./LABS/04-Morphological operations/content.ipynb ./html/LABS/04-Morphological operations/content.html\n", "./LABS/03-Color spaces/content.ipynb ./html/LABS/03-Color spaces/content.html\n", "./LABS/05-Object description/content.ipynb ./html/LABS/05-Object description/content.html\n", "./LABS/01-Image information/content.ipynb ./html/LABS/01-Image information/content.html\n", "./LABS/02-Convolution/content.ipynb ./html/LABS/02-Convolution/content.html\n" ] } ], "source": [ "# export all .ipynb to html\n", "\n", "def replace_ipynb_by_html(fname):\n", " s = open(fname).read()\n", " r = s.replace('.ipynb','.html')\n", " fid = open(fname,'wt')\n", " fid.write(r)\n", " fid.close()\n", "\n", "def convert(chapters,path_source='.',path_dest='./html'):\n", " for c in chapters:\n", " source = os.path.join(path_source,c)\n", " destination = os.path.join(path_dest,c)\n", " names = [os.path.splitext(fn)[0] for fn in os.listdir(source) if fn.endswith('.ipynb')]\n", " for n in names:\n", " nb_filename = os.path.join(source,n+'.ipynb')\n", " html_filename = os.path.join(destination,n+'.html')\n", " print nb_filename, html_filename\n", " # convert notebook\n", " s = !ipython nbconvert --to html --output '$html_filename' '$nb_filename'\n", " replace_ipynb_by_html(html_filename)\n", "\n", "convert(chapters)\n", "convert(labs,'./LABS','./html/LABS')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# convert indexes\n", "nb_filename = os.path.join('.','Index.ipynb')\n", "html_filename = os.path.join('./html','Index.html')\n", "s = !ipython nbconvert --to html --output '$html_filename' '$nb_filename'\n", "replace_ipynb_by_html(html_filename)\n", "\n", "nb_filename = os.path.join('.','Index-labs1-6.ipynb')\n", "html_filename = os.path.join('./html','Index-labs1-6.html')\n", "s = !ipython nbconvert --to html --output '$html_filename' '$nb_filename'\n", "replace_ipynb_by_html(html_filename)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }