-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add job forms for Segmentation and Caliban consumers (#186)
* Update data for job types * Add segmentation and tracking forms * Remove required channels for segmentation * Update Polaris input description * Update example spots image
- Loading branch information
Showing
4 changed files
with
121 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Grid from '@mui/material/Grid'; | ||
import Paper from '@mui/material/Paper'; | ||
import Typography from '@mui/material/Typography'; | ||
// import axios from 'axios'; | ||
import ResolutionDropdown from './ResolutionDropdown'; | ||
import jobData from './jobData'; | ||
|
||
CalibanForm.propTypes = { | ||
selectJobType: PropTypes.element.isRequired, | ||
setJobForm: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default function CalibanForm({ selectJobType, setJobForm }) { | ||
const modelResolution = jobData.segmentation.modelResolution; | ||
const [scale, setScale] = useState(1); | ||
|
||
useEffect(() => { | ||
setJobForm({ scale }); | ||
}, [scale]); | ||
|
||
return ( | ||
<Grid container> | ||
<Paper sx={{ p: 4, height: '100%', width: '100%' }}> | ||
<Grid container spacing={1}> | ||
<Grid item md={6}> | ||
<Grid container direction={'column'} spacing={1}> | ||
{selectJobType} | ||
<Grid item lg> | ||
<Typography>Image Resolution</Typography> | ||
<ResolutionDropdown | ||
modelMpp={modelResolution} | ||
scale={scale} | ||
onChange={setScale} | ||
/> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Paper> | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Grid from '@mui/material/Grid'; | ||
import Paper from '@mui/material/Paper'; | ||
import Typography from '@mui/material/Typography'; | ||
// import axios from 'axios'; | ||
import ResolutionDropdown from './ResolutionDropdown'; | ||
import ChannelForm from './ChannelForm'; | ||
import jobData from './jobData'; | ||
|
||
SegmentationForm.propTypes = { | ||
selectJobType: PropTypes.element.isRequired, | ||
setJobForm: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default function SegmentationForm({ selectJobType, setJobForm }) { | ||
const modelResolution = jobData.segmentation.modelResolution; | ||
const channels = ['nuclei', 'cytoplasm']; | ||
const [requiredChannels] = useState(Array(channels.length).fill(false)); | ||
const [selectedChannels, setSelectedChannels] = useState([...Array(channels.length).keys()]); | ||
const [scale, setScale] = useState(1); | ||
|
||
const updateSelectedChannels = (value, i) => { | ||
setSelectedChannels((selectedChannels) => { | ||
selectedChannels[i] = value; | ||
return [...selectedChannels]; | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
setJobForm({ scale, selectedChannels: selectedChannels.join(',') }); | ||
}, [selectedChannels, scale]); | ||
|
||
return ( | ||
<Grid container> | ||
<Paper sx={{ p: 4, height: '100%', width: '100%' }}> | ||
<Grid container spacing={1}> | ||
<Grid item md={6}> | ||
<Grid container direction={'column'} spacing={1}> | ||
{selectJobType} | ||
<Grid item lg> | ||
<Typography>Image Resolution</Typography> | ||
<ResolutionDropdown | ||
modelMpp={modelResolution} | ||
scale={scale} | ||
onChange={setScale} | ||
/> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item md={6}> | ||
<ChannelForm | ||
channels={channels} | ||
requiredChannels={requiredChannels} | ||
selectedChannels={selectedChannels} | ||
onChange={updateSelectedChannels} | ||
/> | ||
</Grid> | ||
</Grid> | ||
</Paper> | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters