Skip to content

Commit 0abc17e

Browse files
Merge pull request #97 from DiamondLightSource/restructure-repo-for-generalised-imaging-app
Restructure repo for generalised imaging app
2 parents ea9a63c + 42d878f commit 0abc17e

84 files changed

Lines changed: 392 additions & 249 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tomohub
1+
name: Build and Push Containers
22

33
on:
44
push:

README.md

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
1-
# TomoHub
2-
Tomohub is a graphical tool created with React and FastAPI to generate and configure YAML processlists for [HTTOMO](https://diamondlightsource.github.io/httomo/index.html) pacakge and using React Relay and [Workflows](https://github.com/DiamondLightSource/workflows), it's able to run high throughput tomography jobs using [HTTOMO](https://diamondlightsource.github.io/httomo/index.html) as well.
3-
4-
## How to use
5-
In order to run a tomography reconstruction jobs with HTTOMO package, you need to have your data and a processlist (pipeline), these processlists are
6-
basically YAML files with different methods and parameters for the reconstruction job, with both deployment and local versions of tomohub you are able generate these processlists without editting the YAML files directly and then simply download your config files and use them in order to run HTTOMO.
7-
beside generating config files, the local version is able to run HTTOMO jobs as well, after selecting your desired methods (or if you have your own config file as well), you can run HTTOMO by clicking on "Run HTTOMO (Local)" button
8-
### cor finder tool
9-
the main available feature on the local version is COR finder tool, with this tool based on the [parameter sweeping](#parameter-sweeping) feature of HTTOMO, users are able to run a reconstruction job with either of gdric or FBP algorithms and a range of values for centre of rotation, in the result, users can see final png output of the reconstruction job and they can use the slider to see different outputs and select their desired one, this feture is currently implemented with power of workflows.
10-
### Loader
11-
- Configuring the loader for your pipeline is the first essential step to make a processlist, tomohub uses the standard_tomo_loader [see more](https://diamondlightsource.github.io/httomo/reference/loaders.html)
12-
- previewing feature allows you to change the dimensions of the input data by reducing them, in another way is a way to crop your data before the reconstruction job happens [see more](https://diamondlightsource.github.io/httomo/howto/httomo_features/previewing.html)
13-
14-
you can select this fetature by clicking on the "Enable preview" button in the Loader section and select a range to crop in both X and Y axises
15-
### methods
16-
- Tomohub contains all the method from both [httomolib](https://github.com/DiamondLightSource/httomolib) and [httomolibgpu](https://github.com/DiamondLightSource/httomolibgpu) libraries, after setting your Loader, it's needed to select a set of methods for your reconstruction job, a good approach to do so is by following the order of the vertical tab on left
17-
- You can see the list of your methods in the pipeline on the right side bar, you can remove/edit your selected methods and you can also reorder your methods in the processlist by drag and dropping them
18-
### parameter sweeping
19-
- HTTOMO supports parameter sweeping feature, sweeping in this context means you can set more than one value for a parameter in your selected methods [see more](https://diamondlightsource.github.io/httomo/howto/httomo_features/parameter_sweeping.html)
20-
- in order to select sweeping for a parameter, select GEAR_ICON next the parameter input, then simply select your values for your sweeping in the opened pop-up window
21-
- keep in mind as HTTOMO only allows one parameter sweeping per pipeline, you are only allowed to select 1 sweeping per processlist as well
22-
### ready to use pipelines
23-
you can select a ready to use pipelines as well, simply select your pipeline from the "Ready to use piplines"
24-
### Download your processlist
25-
after setting loader and selecting your methods, you can name download your config file and use it with HTTOMO
1+
# ImagingHub
262

273
## Setting up developer environment
284

295
### Clone the repo
306

317
```
32-
git clone https://github.com/DiamondLightSource/TomoHub
8+
git clone https://github.com/DiamondLightSource/ImagingHub
339
```
3410

3511
### Setup frontend
@@ -41,14 +17,14 @@ In `frontend/`, add an `.env.local` file with the following contents:
4117
VITE_API_BASE_URL = "http://localhost:8000"
4218
VITE_KEYCLOAK_URL = "https://identity-test.diamond.ac.uk"
4319
VITE_KEYCLOAK_REALM = "dls"
44-
VITE_KEYCLOAK_CLIENT_ID = "TomoHubDev"
20+
VITE_KEYCLOAK_CLIENT_ID = "ImagingHubDev"
4521
VITE_KEYCLOAK_SCOPE = "openid profile posix-uid email"
4622
```
4723

4824
#### Install dependencies and generate code from GraphQL schema
4925

5026
```
51-
cd Tomohub/frontend
27+
cd ImagingHub/frontend
5228
npm i
5329
npm run relay
5430
npm run dev
@@ -57,7 +33,7 @@ npm run dev
5733
### Setup backend
5834

5935
```
60-
cd Tomohub/backend
36+
cd ImagingHub/backend
6137
pip install -r requirements.txt
6238
pip install httomolibgpu --no-deps
6339
pip install httomo_backends --no-deps

frontend/dashboard/src/App.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {
2+
Card,
3+
CardActionArea,
4+
CardContent,
5+
Container,
6+
Divider,
7+
Grid2,
8+
Typography,
9+
} from "@mui/material";
10+
import { Link } from "react-router-dom";
11+
12+
const TomographyCard = () => {
13+
return (
14+
<Card variant="outlined" sx={{ margin: 2 }}>
15+
<CardActionArea component={Link} to="tomography">
16+
<CardContent sx={{ margin: 2 }}>
17+
<Typography gutterBottom variant="h5">
18+
Tomography
19+
</Typography>
20+
<Divider sx={{ marginTop: 2, marginBottom: 2 }} />
21+
<Typography variant="body2">Web app for HTTomo</Typography>
22+
</CardContent>
23+
</CardActionArea>
24+
</Card>
25+
);
26+
};
27+
28+
const Dashboard: React.FC = () => {
29+
return (
30+
<>
31+
<Container>
32+
<Typography fontSize={30} display="flex" justifyContent="center">
33+
ImagingHub
34+
</Typography>
35+
<Grid2 display="flex">
36+
<TomographyCard />
37+
</Grid2>
38+
</Container>
39+
</>
40+
);
41+
};
42+
43+
export default Dashboard;

frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>TomoHub | GUI for HTTOMO</title>
6+
<title>ImagingHub</title>
77
</head>
88
<body>
99
<div id="root"></div>

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "tomohub-prototype",
2+
"name": "imaginghub",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.5.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

frontend/relay.config.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
2-
"src": "./src",
3-
"language": "typescript",
4-
"schema": "./src/workflows.graphql",
5-
"exclude": ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"],
6-
"eagerEsModules": true
2+
"root": ".",
3+
"projects": {
4+
"tomography": {
5+
"language": "typescript",
6+
"schema": "src/workflows.graphql",
7+
"eagerEsModules": true
8+
}
9+
},
10+
"sources": {
11+
"tomography/src": "tomography"
12+
},
13+
"excludes": ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]
714
}

frontend/src/App.tsx

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
1-
import React, { useState, Suspense } from "react";
2-
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
3-
import Home from "./components/pages/Home";
4-
import Layout from "./components/common/Layout";
5-
import Methods from "./components/pages/Methods";
6-
import FullPipelines from "./components/pages/FullPipelines";
7-
import Submission from "./components/workflows/Submission";
8-
import Crop from "./components/pages/Crop";
9-
import { Visit } from "@diamondlightsource/sci-react-ui";
1+
import { Route, BrowserRouter, Routes } from "react-router-dom";
2+
import { default as TomographyApp } from "../tomography/src/App";
3+
import Dashboard from "../dashboard/src/App";
4+
import Layout from "./Layout";
105

116
const App: React.FC = () => {
12-
const [userVisit, setUserVisit] = useState<Visit>();
137
return (
14-
<Router>
15-
<Suspense fallback={<div>Loading workflow...</div>}>
16-
<Routes>
17-
<Route path="/" element={<Layout />}>
18-
<Route index element={<Home />} />
19-
<Route path="methods" element={<Methods />} />
20-
<Route path="fullpipelines" element={<FullPipelines />} />
21-
<Route
22-
path="workflow-run"
23-
element={
24-
<Submission
25-
workflowName="httomo-gpu-job"
26-
setVisit={setUserVisit}
27-
/>
28-
}
29-
/>
30-
<Route
31-
path="workflow-cor"
32-
element={
33-
<Submission
34-
workflowName="httomo-cor-sweep"
35-
setVisit={setUserVisit}
36-
/>
37-
}
38-
/>
39-
<Route path="crop" element={<Crop setVisit={setUserVisit} />} />
40-
</Route>
41-
</Routes>
42-
</Suspense>
43-
</Router>
8+
<BrowserRouter>
9+
<Routes>
10+
<Route path="/" element={<Layout />}>
11+
<Route index element={<Dashboard />} />
12+
<Route path="tomography/*" element={<TomographyApp />} />
13+
</Route>
14+
</Routes>
15+
</BrowserRouter>
4416
);
4517
};
4618

frontend/src/Layout.tsx

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import React from "react";
2+
import { Outlet, NavLink as RouterNavLink } from "react-router-dom";
3+
import { Box, CssBaseline, styled } from "@mui/material";
4+
import {
5+
Footer,
6+
Navbar,
7+
NavLink,
8+
NavLinks,
9+
User,
10+
} from "@diamondlightsource/sci-react-ui";
11+
import keycloak from "./keycloak";
12+
13+
const AppContainer = styled(Box)({
14+
display: "flex",
15+
flexDirection: "column",
16+
minHeight: "100vh",
17+
alignItems: "center",
18+
backgroundColor: "#fff",
19+
overflowX: "hidden",
20+
});
21+
22+
const MainContainer = styled(Box)({
23+
display: "grid",
24+
gap: "30px",
25+
padding: "20px",
26+
flex: 1,
27+
alignItems: "flex-start",
28+
margin: "30px auto",
29+
});
30+
31+
const Layout = () => {
32+
// Determine the username to display
33+
let username = "Guest User";
34+
35+
if (keycloak.authenticated && keycloak.tokenParsed) {
36+
username =
37+
keycloak.tokenParsed.preferred_username ||
38+
keycloak.tokenParsed.name ||
39+
keycloak.tokenParsed.email ||
40+
"Authenticated User";
41+
}
42+
43+
// Handle logout
44+
const handleLogout = () => {
45+
if (keycloak.authenticated) {
46+
keycloak.logout();
47+
}
48+
};
49+
50+
return (
51+
<>
52+
<CssBaseline />
53+
<AppContainer>
54+
<Navbar
55+
logo="theme"
56+
leftSlot={
57+
<NavLinks>
58+
<NavLink to="/" linkComponent={RouterNavLink}>
59+
Home
60+
</NavLink>
61+
<NavLink to="/tomography" linkComponent={RouterNavLink}>
62+
Tomography
63+
</NavLink>
64+
</NavLinks>
65+
}
66+
rightSlot={
67+
<User
68+
color="white"
69+
onLogout={handleLogout}
70+
user={{
71+
fedid: username,
72+
}}
73+
/>
74+
}
75+
></Navbar>
76+
<MainContainer>
77+
<Outlet />
78+
</MainContainer>
79+
<Footer
80+
copyright=""
81+
logo="theme"
82+
style={{
83+
width: "100%",
84+
backgroundColor: "#4C5266",
85+
display: "flex",
86+
justifyContent: "center",
87+
}}
88+
></Footer>
89+
</AppContainer>
90+
</>
91+
);
92+
};
93+
94+
export default Layout;

frontend/src/components/common/Guide.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)