MorphoNet.Net

This module provides various functions to upload data and interact with the MorphoNet database.

The detail of all all accessible functions can be found here.

We provide here some basic examples to interact with the MorphoNet Database.

Connect to the MorphoNet Database

First you have to connect with the API to the morphonet database using your credentials.

import morphonet
mn=morphonet.Net("yourlogin","yourpassword")

Interact with your datasets

Create your dataset

You can simply create a dataset using this function. mn.create_dataset("test set",minTime=1,maxTime=150) (more parameters are accessible in the documentation)

List your datasets

To display the datasets you own, you can use : mn.list_my_dataset() It will display all your datasets like this

(id_set) set_name is data_type created by set_owner the creation_date

To display dataset you can access (even if you're not owner) : mn.list_dataset()

Select a dataset

You can either select a dataset by name or by id using mn.select_dataset_by_name(thenameofmydataset) or mn.select_dataset_by_id(thenIDofmydataset)

These 2 function will bind the selected dataset to active dataset attached to the session, being able to use other functions to modify/share the dataset.

Share a dataset

You can share your datasets with a specific user or a specific group.

To share with an user , you can use this function share_dataset_with_user(id_user,role) To shere it with a group , use this function share_dataset_with_group(id_group,role)

Access to a user or a group.

In order to have access to the id for a user or a group, you can use these two functions

mn.get_guy_by_name('Surname name')

mn.get_group_by_name("group_name")

that both return the id of the corresponding group/user.

For the user one, it's really important to add a space between name and surname !

As an example :

mn.share_dataset_with_group(mn.get_group_by_name("testgroup"),0)

Update a dataset

You can update a dataset using this function update_dataSet(name,minTime,maxTime,id_NCBI,id_type)

You can fill only a portion of the parameters, the missing ones will keep the old dataset values.

In order to change the dataset description you can use this function upload_description(newdescription)

Delete a dataset

There is 2 ways do delete a dataset, you can :

Delete all data from server (including set itself and sharings) using delete_dataset()

Or clear data from server (only meshes and properties) with clear_dataset()


Convert your segmented images in Meshes

You can convert your segmented images in Meshes using the function :

convert_to_OBJ

You have to specify in parameters:

  • dataFull: the segmented images in a numpy matrix
  • t : the time point (default 0)

And optionaly : * background : the background value (default 0) * factor : the desired scaling factor (default 1) * channel : the channel (default None) * z_factor : the desired scaling depth factor (default 1) * Smooth : (Default True) * smooth_passband : (Default 0.01 ) * smooth_iteration : (Default 25 ) * Decimate :(Default True) * QC_divisions : (Default 1) * Reduction : (Default True) * TargetReduction : (Default 0.8) * DecimationThreshold : (Default 30) * Borde : (Default 2) * center: (Default [0,0,0]) * VoxelSize: (Default [1,1,1]) * maxNumberOfThreads: (Default None)

You can find more information in this example and in the code of the function.


Manage Meshes

Morphological data must be uploaded to MorphoNet server under the form of surface meshes.

More specifically, we employ the most common format to represent meshes, i.e., the obj format In order to have access to all MorphoNet features please follow the format procedure.


Notice that for all theses functions , you first have to create or select a dataset.

Upload a new mesh

You can start by the upload of mesh at a specific time step using this function upload_mesh_at(t,obj,quality,channel,link,texture,material,ttype)

Access to a mesh

You can get your mesh using this function get_mesh_at(self,t,quality,channel)

Delete a specific mesh

You can delete your uploaded mesh from the server using this function clear_mesh_at(self,t,quality,channel)


Manage Properties

In order to fully exploit the interdisciplinary networking structure of our morphological browser, you can upload your own morphological properties.

Please follow first this format help in order to get the correct format for your additional properties.


Notice that for all theses functions , you first have to create or select a dataset.

Display the properties format

You can have access to a simple reminder on the properties, format type using show_property_type()

Upload a new property

In order to upload your properties you can use this function upload_property(property, field) where field represent the content of the property (text data respecting the corresponding format).

List properties of a selected dataset

You can list all properties associated to your dataset using get_properties()

Get the property .

You can get the detail of the property from the server using in 2 ways: - with the property ID (int) using get_property_by_id(id_property) - with the property name (text) using get_property_by_name(name) both will return the property data that is parsed by the viewer to display it.

Delete any property

In the same way you can delete the property using delete_property_by_id or delete_property_by_name


Manage primitives

In case of multiple repetition of the same pattern you can use the primitive concept.

You just have to upload first the pattern and after call it in you different mesh files.

Notice that primitives are always associated to one dataset only.

Upload a primitive

In order to first upload a primitive use this function upload_primitive(name,obj) where obj represents the primitive in the classical meshes format. Please note that the primitive

Upload a Mesh which contains primitives

Associated to your dataset, you can now upload your meshes with primitives using upload_mesh_with_primitive_at(t,obj,quality=0,channel=0)

Delete a specific primitive

In order to delete delete a previously uploaded primitive from the database, use delete_primitive(name)

Clear all primitives

To clear all primitives associated to a dataset from the database, use clear_primitive()