Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
97cdc2f
Implement vo9lume viewr in React
Aug 8, 2024
8ecfe71
add readme
Aug 8, 2024
89ced8e
Fix issue with wrong file extension check
Oct 8, 2024
a523606
Add configuration url
Oct 8, 2024
dd6444f
Add histogram controls for opacity, window, and level adjustments in …
Oct 15, 2024
6fef2c4
Ensure opacity can be controlled
Oct 16, 2024
8a6f1c3
Add deployment script
Oct 23, 2024
171b768
Change texts accordingly
Oct 24, 2024
9984d2b
Add deployment script
Oct 23, 2024
748d003
Change title and logo
Oct 25, 2024
366a3cc
Refine deployment script
Oct 25, 2024
1926898
Change title
Oct 25, 2024
8596d2a
Refine ui
Oct 31, 2024
5cac577
Fix color picker, mask aplha and gamma settings
Nov 5, 2024
af45268
Add playback and other refinements
Nov 7, 2024
b4b1ef3
Add playback and other refinements
Nov 7, 2024
9c2e881
Ensure to persist mode
Nov 7, 2024
8775d8d
Ensure to propelry tab the settings and data
Nov 12, 2024
906600a
Add mising ddependencies
Nov 12, 2024
ca6ccf5
Ensure that all the tabs fit properly
Nov 12, 2024
b44b7bb
Ensure minification on build
Nov 12, 2024
eda59e7
Ensure that the player is positioned on canvas
Nov 18, 2024
81b1009
fix xccs
Nov 18, 2024
29d2e6e
Ensure that OME-Zarr files are supported
Nov 21, 2024
549f5f3
Fix rounding issue
Nov 21, 2024
4ed19e4
Address comments and issues
Nov 22, 2024
43f2b4a
Use specified oixel size
Nov 22, 2024
09027e0
Conditionally display maskAlpha
Nov 22, 2024
02666da
Ensure that player is postioned properly
Nov 25, 2024
e406492
Ensure planar slice player stays visible in 2D camera mode
Nov 25, 2024
8cf7989
adjust gamma slider margins to prevent text cutoff
Nov 25, 2024
2f44f8b
Implement intuitive slice-based clipping control
Nov 26, 2024
d75df8f
Add histogram plot and custom intensity adjustment controls
Nov 29, 2024
59cb926
Refine description text
Nov 29, 2024
333613d
Add d3 for the plot canvas and interactions
Nov 29, 2024
62a0cab
Refine styles and add titel to plot
Dec 2, 2024
9882717
Facelift channels section and also add htaccess
Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .env.production

REACT_APP_API_URL=https://cellmigration.isas.de/api
REACT_APP_UPLOAD_FOLDER=https://cellmigration.isas.de/uploads
112 changes: 67 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,92 @@
# Getting Started with Create React App
# 3D Volume Viewer Application

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This application is a 3D volume viewer designed to visualize medical imaging data of mouse body parts. The frontend is built with React and communicates with a Node.js backend that serves the volume files. Users can select different body parts and view the corresponding 3D volume files.

## Available Scripts
## Table of Contents

In the project directory, you can run:
1. [Features](#features)
2. [Installation](#installation)
3. [Usage](#usage)
4. [File Structure](#file-structure)
5. [API Endpoints](#api-endpoints)
6. [Technologies Used](#technologies-used)
7. [Contributing](#contributing)
8. [License](#license)

### `npm start`
## Features

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
- Visualize 3D volume data in various formats (OME-TIFF, OME-ZARR, TIFF).
- Control rendering modes (Path Trace, Ray March).
- Adjust visualization parameters such as density, exposure, and gamma.
- Manipulate lighting settings and camera modes.
- Playback functionality for time-series data.
- Dynamic channel controls to adjust color and material properties.
- Set clipping regions and view bounding boxes.
- Flip volume along different axes.
- Screenshot capturing functionality.
- RESTful API for serving volume files.

The page will reload when you make changes.\
You may also see any lint errors in the console.
## Installation

### `npm test`
### Prerequisites

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
- Node.js (v12 or later)
- npm (v6 or later)

### `npm run build`
### Backend Setup

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
1. Clone the repository:
```bash
git clone https://github.com/yourusername/3d-volume-viewer.git
cd 3d-volume-viewer
```

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
2. Navigate to the backend directory:
```bash
cd server
```

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
3. Install dependencies:
```bash
npm install
```

### `npm run eject`
4. Start the server:
```bash
npm start
```

**Note: this is a one-way operation. Once you `eject`, you can't go back!**
### Frontend Setup

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
1. Navigate to the frontend directory:
```bash
cd ../client
```

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
2. Install dependencies:
```bash
npm install
```

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
3. Start the development server:
```bash
npm start
```

## Learn More
4. Open your browser and navigate to `http://localhost:3000`.

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
## Usage

To learn React, check out the [React documentation](https://reactjs.org/).
### Upload Files

### Code Splitting
1. Place your volume files in the appropriate directories under `server/uploads`. Each directory represents a different body part (e.g., `liver`, `brain`).

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### View and Manipulate Volumes

### Analyzing the Bundle Size
1. Use the file selector in the frontend to choose a body part and a specific volume file.
2. Adjust rendering and visualization settings using the provided controls.
3. Use playback controls to navigate through time-series data.
4. Capture screenshots using the screenshot button.

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
## File Structure

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
96 changes: 96 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash

# Exit the script if any command fails
set -e

# Configuration variables
PROJECT_DIR="." # Frontend root remains in 3D-Cell-Viewer
FRONTEND_DIR="$PROJECT_DIR"
WEB_SERVER_ROOT="/var/www/vhosts/lsfm.isas.de"

# Generate a new release branch name with timestamp
RELEASE_BRANCH="release-$(date +'%Y%m%d%H%M%S')"

echo "Creating a new release branch: $RELEASE_BRANCH"

# Get the current branch name
CURRENT_BRANCH=$(git branch --show-current)

# Checkout to the 'ft-create-deployment-script' branch if not already on it
if [ "$CURRENT_BRANCH" != "ft-create-deployment-script" ]; then
echo "Switching to 'ft-create-deployment-script' branch..."
git checkout ft-create-deployment-script
else
echo "Already on 'ft-create-deployment-script' branch."
fi

# Pull the latest changes from the remote repository
echo "Pulling the latest changes from 'ft-create-deployment-script' branch..."
git pull origin ft-create-deployment-script

# Create a new release branch from the current branch
git checkout -b "$RELEASE_BRANCH"

# Optionally, push the new release branch to the remote repository (uncomment if needed)
# git push origin "$RELEASE_BRANCH"

# Set environment variables for the API and file storage server
export REACT_APP_API_URL="https://cellmigration.isas.de/api"
export REACT_APP_UPLOAD_FOLDER="https://cellmigration.isas.de/uploads"

# Create .htaccess file in the public directory
echo "Creating .htaccess file..."
cat > "$FRONTEND_DIR/public/.htaccess" << 'EOL'
# Enable rewrite engine
RewriteEngine On

# If the requested resource exists as a file or directory, serve it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise, redirect all requests to index.html
RewriteRule ^ index.html [QSA,L]

# Set security headers
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-XSS-Protection "1; mode=block"
Header set Referrer-Policy "strict-origin-when-cross-origin"

EOL

# Proceed with the frontend deployment
echo "Starting frontend-only deployment..."

# Move to the frontend directory and install dependencies
echo "Installing npm dependencies..."
cd "$FRONTEND_DIR"
npm install

# Building the React Application
echo "Building and minifying the React app for production..."
NODE_ENV=production npm run build

# Check if the web server root directory exists, if not, create it
if [ ! -d "$WEB_SERVER_ROOT" ]; then
echo "Directory $WEB_SERVER_ROOT does not exist. Creating it now..."
sudo mkdir -p "$WEB_SERVER_ROOT"
sudo chown -R www-data:www-data "$WEB_SERVER_ROOT"
sudo chmod -R 755 "$WEB_SERVER_ROOT"
echo "Directory $WEB_SERVER_ROOT created successfully."
fi

# Deploy the built React app
echo "Copying the React build files to the web server root..."
sudo rm -rf "$WEB_SERVER_ROOT"/*
sudo cp -r "$FRONTEND_DIR/build/"* "$WEB_SERVER_ROOT"

# Copy .htaccess file
echo "Copying .htaccess file..."
sudo cp "$FRONTEND_DIR/public/.htaccess" "$WEB_SERVER_ROOT/.htaccess"

# Set correct ownership and permissions
echo "Changing ownership of the web server root directory to www-data user..."
sudo chown -R www-data:www-data "$WEB_SERVER_ROOT"

echo "Frontend deployment completed successfully."
Loading