Package: ahds
ContentsOverviewLicenseUse CasesInstallationGetting StartedFuture PlansOverviewahdsis a Python package to parse and handle Amira (R) files.
It was developed to facilitate reading of Amira (R) files as part of theEMDB-SFF toolkit.NoteAmira (R) is a trademark of Thermo Fisher Scientific. This package is in no way affiliated with with Thermo Fisher Scientific.Licenseahdsis free software and is provided under the terms of the Apache License, Version 2.0.Copyright 2017 EMBL - European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the License.Use CasesDetect and parse Amira (R) headers and return structured dataDecode data (HxRLEByte,HxZip)Easy extensibility to handle previously unencountered data streamsahdswas written and is maintained by Paul K. Korir but there isa list of contributors.
Feel free to join this initiative.Installationahdsworks with Python 2.7, 3.5, 3.6 and 3.7. It requiresnumpyto build.pip install numpyAfterwards you may runpip install ahdsNoteFigure out a way to avoid the need fornumpyas part of the build.Getting StartedYou can begin playing withahdsout of the box using the provided console commandahds.me@home~$ahdsahds/data/FieldOnTetraMesh.am********************************************************************************************************************************************AMIRA(R)HEADERANDDATASTREAMS--------------------------------------------------------------------------------------------------------------------------------------------+-ahds/data/FieldOnTetraMesh.amAmiraFile[is_parent?True]|+-metaBlock[is_parent?False]||+-file:ahds/data/FieldOnTetraMesh.am||+-header_length:182||+-data_streams:1||+-streams_loaded:False|+-headerAmiraHeader[is_parent?True]||+-filetype:AmiraMesh||+-dimension:3D||+-format:BINARY||+-endian:BIG||+-version:2.0||+-extra_format:None||+-ParametersBlock[is_parent?False]||+-TetrahedraBlock[is_parent?False]|||+-length:23685|+-data_streamsBlock[is_parent?False]********************************************************************************************************************************************Theahdscommand takes the following argumentsme@home~$ahds-husage:ahds[-h][-s][-d][-l]file[file...]PythontooltoreadanddisplayAmirafilespositionalarguments:fileavalidAmirafilewithanoptionalblockpathoptionalarguments:-h,--helpshowthishelpmessageandexit-s,--load-streamswhethertoloaddatastreamsornot[default:False]-d,--debugdisplaydebugginginformation[default:False]-l,--literaldisplaytheliteralheader[default:False]You can specify adotted pathafter the filename to only render that the content of that field in the header:me@home~$ahdsahds/data/FieldOnTetraMesh.amheader***********************************************************************************************************************************ahds:Displayingpath'header'-----------------------------------------------------------------------------------------------------------------------------------+-headerAmiraHeader[is_parent?True]|+-filetype:AmiraMesh|+-dimension:3D|+-format:BINARY|+-endian:BIG|+-version:2.0|+-extra_format:None|+-ParametersBlock[is_parent?False]|+-TetrahedraBlock[is_parent?False]||+-length:23685For debugging you can display the literal header (the exact header present in the file) using the-l/--literalflag.
Also, you can display the parsed data structure using the-d/--debugflag.me@home~$ahds--literal--debugahds/data/FieldOnTetraMesh.am***********************************************************************************************************************************ahds:Displayingliteralheader-----------------------------------------------------------------------------------------------------------------------------------# AmiraMesh 3D BINARY 2.0
# CreationDate: Tue Nov  2 11:46:31 2004nTetrahedra23685TetrahedronData{float[3]Data}@1Field{float[3]f}Constant(@1)# Data section follows***********************************************************************************************************************************ahds:Displayingparsedheaderdata-----------------------------------------------------------------------------------------------------------------------------------[{'designation':{'dimension':'3D','filetype':'AmiraMesh','format':'BINARY','version':'2.0'}},{'comment':{'date':'Tue Nov  2 11:46:31 2004'}},{'array_declarations':[{'array_dimension':23685,'array_name':'Tetrahedra'}]},{'data_definitions':[{'array_reference':'Tetrahedra','data_dimension':3,'data_index':1,'data_name':'Data','data_type':'float'},{'array_reference':'Field','data_dimension':3,'data_index':1,'data_name':'f','data_type':'float','interpolation_method':'Constant'}]}]********************************************************************************************************************************************AMIRA(R)HEADERANDDATASTREAMS--------------------------------------------------------------------------------------------------------------------------------------------+-ahds/data/FieldOnTetraMesh.amAmiraFile[is_parent?True]|+-metaBlock[is_parent?False]||+-file:ahds/data/FieldOnTetraMesh.am||+-header_length:182||+-data_streams:1||+-streams_loaded:False|+-headerAmiraHeader[is_parent?True]||+-filetype:AmiraMesh||+-dimension:3D||+-format:BINARY||+-endian:BIG||+-version:2.0||+-extra_format:None||+-ParametersBlock[is_parent?False]||+-TetrahedraBlock[is_parent?False]|||+-length:23685|+-data_streamsBlock[is_parent?False]********************************************************************************************************************************************By default, data streams are not read — only the header is parsed. You may obtain the data streams using the-s/--load-streamsflag.me@home~$ahds--load-streamsahds/data/FieldOnTetraMesh.am********************************************************************************************************************************************AMIRA(R)HEADERANDDATASTREAMS--------------------------------------------------------------------------------------------------------------------------------------------+-ahds/data/FieldOnTetraMesh.amAmiraFile[is_parent?True]|+-metaBlock[is_parent?False]||+-file:ahds/data/FieldOnTetraMesh.am||+-header_length:182||+-data_streams:1||+-streams_loaded:True|+-headerAmiraHeader[is_parent?True]||+-filetype:AmiraMesh||+-dimension:3D||+-format:BINARY||+-endian:BIG||+-version:2.0||+-extra_format:None||+-ParametersBlock[is_parent?False]||+-TetrahedraBlock[is_parent?False]|||+-length:23685|+-data_streamsBlock[is_parent?True]||+-DataAmiraMeshDataStream[is_parent?False]|||+-data_index:1|||+-dimension:3|||+-type:float|||+-interpolation_method:None|||+-shape:23685|||+-format:None|||+-data:[0.89173080.9711809300.],...,[1.43905041.1243758300.]********************************************************************************************************************************************Future PlansWrite out valid Amira (R) files