<jupyter_start><jupyter_text>IsicApi overview (from isicarchive package) InstallationTo use the IsicApi class, please first install the isicarchivepackage from github, which is more frequently updated for now:~~~~pip install --upgrade git+https://github.com/neuroelf/isicarchive~~~~Or for a more stable release, you can install from PyPi using:~~~~pip install --upgrade isicarchive~~~~<jupyter_code># Make sure the latest isicarchive package is installed!
import sys
!{sys.executable} -m pip install --upgrade isicarchive<jupyter_output><empty_output><jupyter_text>Import and use the ```IsicApi``` object from the isicarchive module ***Please change the username and cache_folder!***And please note that depending on which user is logged into thedatabase, the responses from the (web-based) API differ: forinstance, the number of datasets, images, and studies you haveaccess to depends on the settings on these datasets, images, andstudies.If you wish to work with the IsicApi object both with and withoutuser permissions, please use two **separate** cache folders, forotherwise the image caching routine will be thrown off by thedifferent number of images you have access to!The image cache file will be written into```/0/imcache_000000000000000000000000.json.gz```and for the full database (being authenticated with admin privileges)takes about 3.5MByte at this time (~ 100MB uncompressed).You may want to periodically re-create this cache file if you usethe database without user authentication, since the order in whichthe image are received is based on their objectId in the database,meaning that if images that were uploaded but only recently madepublic, the cache will be "out of sync" and needs to be recreated.<jupyter_code># Import isicapi
from isicarchive import IsicApi, func

# Set username and password (to None!)
username = None # set this to '<EMAIL>' after registration!
password = <PASSWORD>

# for Windows
cache_folder = 'C:\\Data\\some\\folder'

# for Mac/Linux
#cache_folder = '/Data/some/folder'

# Instantiate API, will ask for password using getpass.getpass(...)
api = IsicApi(username, password, cache_folder=cache_folder)

# load cached images
api.cache_images()

# pretty-print api object
api<jupyter_output><empty_output><jupyter_text>Example usage to retrieve information from the archiveStudies (as well as datasets and images) can be retrieved eitherusing their objectId (```_id``` field in the web-based API), orusing their name. Please note, some elements in the archive maynot be publicly available. If you are not logged into the APIwith the necessary privileges, you will only be able to accessthe portion of database you have access to.<jupyter_code># print available studies
api.list_studies()
# Retrieve a study
study = api.study('ISIC Annotation Study - All Features')

# load annotations (will only work if logged in!)
study.load_annotations()

# print some information about the study
study
# Retrieve an image for this study
image = api.image(study.images[0])

# Load the image data (from cache or online)
image.load_image_data()

# And load the superpixels, and parse into coordinates map
image.load_superpixels()
image.map_superpixels()

# print information
image
# show in notebook
image.show_in_notebook(max_size=400)
# Retrieve an annotation
annotation = api.annotation(study.annotations[0])

# print information about the annotation
annotation
# Show the first feature in cyan, 70% opacity
annotation.show_in_notebook(features={'Globules / Clods : Lacunae : Red': [[0,255,255], 0.7]})
# and get some information on the dataset of the image
dataset = api.dataset(image.dataset)
dataset.load_images()
dataset
# show several annotations for several images
study.show_annotations(images=['ISIC_0001115', 'ISIC_0001129', 'ISIC_0001130', 'ISIC_0001149'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07943558923438725, 'fraction_numerical': 0.019336294747844266, 'mean_word_length': 5.847942754919499, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '214176', 'license': 'MIT', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1024, 'n_words': 451, 'path': 'Overview.ipynb', 'repo_name': 'neuroelf/isic-archive', 'size': '3835'}