{ "cells": [ { "cell_type": "markdown", "id": "8a36b1a1", "metadata": {}, "source": [ "# Upload Example" ] }, { "cell_type": "markdown", "id": "806e871d", "metadata": {}, "source": [ "This notebook shows how to create a dataset , than upload 1 or multiple mesh at the first time point\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "b77b8290", "metadata": {}, "outputs": [], "source": [ "import morphonet\n", "import os" ] }, { "cell_type": "code", "execution_count": null, "id": "51d81ea4", "metadata": {}, "outputs": [], "source": [ "mn_login=\"user\"\n", "mn_password=\"password\"\n", "mn=morphonet.Net(mn_login,mn_password)" ] }, { "cell_type": "markdown", "id": "76ad53e2", "metadata": {}, "source": [ "Select the dataset : if it exists, clear it than select, otherwise create it than select it\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e890c2b1", "metadata": {}, "outputs": [], "source": [ "datasetname='TESTUPLOADMULTIPLEMESHES'\n", "id_dataset=mn.select_dataset_by_name(datasetname)\n", "if mn.id_dataset==-1 :\n", "\tmn.create_dataset(datasetname)\n", "else:\n", "\tmn.clear_dataset()" ] }, { "cell_type": "markdown", "id": "57542955", "metadata": {}, "source": [ "Upload multiple mesh at the time point 0\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "16a785ac", "metadata": {}, "outputs": [], "source": [ "for objf in os.listdir('DATASET/Multiple_Objs/'):\n", "\tif objf.find(\".obj\"):\n", "\t\tobj = mn.read_mesh('DATASET/Multiple_Objs/'+objf)\n", "\t\tmn.upload_mesh_at(0,obj)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }