semvec/pypi-packages huggingface dataset:
v1dd-physiology 1.0
SDK for volumetric multi-photon data of V1 DeepDive project
Requires Python: >3.8

# v1dd_physiology  
This python package allows the interaction with the Allen Institute V1 DeepDive Physiology data set. This data set contains dense calcium imaging (two-photon and three-photon) of excitatory neurons at the center of mouse primary visual cortex while displaying various visual stimuli. In total, data were collected from four mice expressing GCaMP6s as calcium indicator in excitatory neurons. The base data format loosely follows the [Neurodata Without Borders (nwb)](https://www.nwb.org/) standard.

Importantly, the imaged tissue of one mouse were processed by volumetric EM processing and reconstruction to reveal detailed anatomical structures and synaptic-level connectome.  

The description of the data set can be found [here](https://github.com/zhuangjun1981/v1dd_physiology/blob/main/v1dd_physiology/meta/database_description.md).  

The project white paper can be found [here](https://github.com/zhuangjun1981/v1dd_physiology/blob/main/v1dd_physiology/meta/V1DD_WhitePaper_v6.pdf) and additional meta data can be found [here](https://github.com/zhuangjun1981/v1dd_physiology/tree/main/v1dd_physiology/nwb_building/meta_lims).  

The example for using this package can be found in these [ipython notebooks](https://github.com/zhuangjun1981/v1dd_physiology/tree/main/v1dd_physiology/example_notebooks).  

A recorded video introducing this database can be found [here](https://alleninstitute.sharepoint.com/sites/TheBrainObservatoryAnalysisSuperTeam/Shared%20Documents/General/Recordings/Group%20Meeting-20220701_120405-Meeting%20Recording.mp4?web=1) or as a mp4 file: `\\allen\programs\mindscope\workgroups\surround\v1dd_in_vivo_new_segmentation\v1dd_physiology_intro_JunZhuang-20220701.mp4`

&nbsp;
## Special dependency
* [NeuroAnalysisTools](https://github.com/zhuangjun1981/NeuroAnalysisTools)  

&nbsp;
## Install
#### Create environment
```
> conda create -n v1dd python=3
> conda activate v1dd
```

#### Install volume_imaging_2P_analysis
```
> pip install v1dd_physiology
```  
  
or  

```
> git clone https://github.com/AllenInstitute/v1dd_physiology.git
> cd v1dd_physiology
> pip install .
``` 
  
#### Install Jupyter Notebook
```
> conda install jupyter jupyterlab
> python -m ipykernel install --user --name v1dd --display-name "Python3 (v1dd)"
```
NeuroAnalysisTools 3.1.0
Data analysis tools for systems neuroscience
Requires Python: >3.0

# NeuroAnalysisTools  
Data analysis tools for systems neuroscience  
  
# Install  
```
> conda create -n nat python=3
> conda activate nat ("source activate nat" for mac or linux)
> git clone https://github.com/zhuangjun1981/NeuroAnalysisTools.git
> cd NeuroAnalyisTools
> python setup.py install
```  
  
or  
  
```
> conda create -n nat python=3
> conda activate nat ("source activate nat" for mac or linux)
> pip install NeuroAnalysisTools
```
fastapi-frame-stream 0.1.1
Package to easily stream individual frames (MJPEG) using FastAPI
Requires Python: >=3.7

# fastapi-frame-stream

Package to easily stream individual frames (MJPEG) using FastAPI.

FastAPI server for publishing and viewing MJPEG streams.

Raw image files and images as base64 strings can be sent to a 'video stream' and then consumed by any client.

## Quick start

### Installing

```cmd
pip install fastapi-frame-stream
```

#### Requirements

- [FastAPI](https://fastapi.tiangolo.com/)
- [uvicorn](https://www.uvicorn.org/)

<details>
  <summary><i>NOTE:</i></summary>
  This package will also automatically install:

- imutils
- opencv-python
- python-miltipart

</details>

### How to use

#### Server

You can create a simple FastAPI server where it is possible to publish and get multiple streams.

![usage code](./_readme_imgs/usage_code.svg)

<details>
<summary><i>full code</i></summary>

```python
from fastapi import FastAPI, File, UploadFile
import uvicorn
from pydantic import BaseModel
from fastapi_frame_stream import FrameStreamer

app = FastAPI()
fs = FrameStreamer()

class InputImg(BaseModel):
    img_base64str : str


@app.post("/send_frame_from_string/{stream_id}")
async def send_frame_from_string(stream_id: str, d:InputImg):
    await fs.send_frame(stream_id, d.img_base64str)


@app.post("/send_frame_from_file/{stream_id}")
async def send_frame_from_file(stream_id: str, file: UploadFile = File(...)):
    await fs.send_frame(stream_id, file)


@app.get("/video_feed/{stream_id}")
async def video_feed(stream_id: str):
    return fs.get_stream(stream_id)


if __name__ == '__main__':
    uvicorn.run(app, host="0.0.0.0", port=5000)
```

</details>

#### Client

Any client can view a published image (MJPEG) stream using a simple ```<img>``` tag:

![usage code](./_readme_imgs/client_code.svg)

<details>
<summary><i>full code</i></summary>

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Testing fastapi-frame-stream</title>
</head>
<body>
    <img src="http://localhost:5000/video_feed/my_new_stream001">
</body>
</html>
```

</details>

#### All together

It is possible to upload an image file directly...

![Server and client](https://raw.githubusercontent.com/TiagoPrata/fastapi-frame-stream/main/_readme_imgs/usage001.gif)

... or to use any kind of application to convert the frames to base64 and send it to the web server:

![Server and client](https://raw.githubusercontent.com/TiagoPrata/fastapi-frame-stream/main/_readme_imgs/usage002.gif)

<h4><i>How it works</i></h4>

<details>
<summary></summary>

The frames sent throught the web server are stored in a temporary (in memory) SQLite DB...

![User sending frame](./_readme_imgs/sending_frame.png)

... and the last frame of each stream is retrieved everytime a client wants to visualize the stream.

![Retrieving stream](./_readme_imgs/getting_stream.png)

</details>