-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new mesh API for animation job #7692
Merged
Merged
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5af5856
updated animation job to use proxy mesh infromation for new mesh api
hotzenklotz f796435
added ad-hoc meshes to animation job
hotzenklotz 3434c53
pass fallback layer and adhoc meshing options to worker
hotzenklotz 8bf5e6a
upadted changelog
hotzenklotz 2674a0d
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz a4180eb
updated wk docs
hotzenklotz 0566b88
apply PR feedback
hotzenklotz ba2a6fb
apply PR feedback 2
hotzenklotz 5c8e0d9
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz 0e8ea9b
reverted colorLayerName to layerName
hotzenklotz 84695f2
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz 7854967
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz ba0e7e6
use tracing id for animations
hotzenklotz 7bc9f90
remove view mode parameter from animations
hotzenklotz 81297dc
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz f524ede
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz d74b2c9
also store mappingName for precomputed mesh info objects
philippotto 14e2fd1
Merge branch 'master' of github.com:scalableminds/webknossos into ani…
hotzenklotz 95e5dd3
fix animation modal error message for DS without color layers
hotzenklotz 5cad71f
Merge branch 'master' into animation_meshes_api
hotzenklotz e26ac18
Merge branch 'master' into animation_meshes_api
hotzenklotz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -11,6 +11,8 @@ import { | |||||||
getColorLayers, | ||||||||
getEffectiveIntensityRange, | ||||||||
getLayerByName, | ||||||||
getResolutionInfo, | ||||||||
hasFallbackLayer, | ||||||||
is2dDataset, | ||||||||
} from "oxalis/model/accessors/dataset_accessor"; | ||||||||
import { | ||||||||
|
@@ -24,16 +26,16 @@ import { | |||||||
MOVIE_RESOLUTIONS, | ||||||||
APIDataLayer, | ||||||||
APIJobType, | ||||||||
APISegmentationLayer, | ||||||||
} from "types/api_flow_types"; | ||||||||
import { InfoCircleOutlined } from "@ant-design/icons"; | ||||||||
import { PricingEnforcedSpan } from "components/pricing_enforcers"; | ||||||||
import { | ||||||||
PricingPlanEnum, | ||||||||
isFeatureAllowedByPricingPlan, | ||||||||
} from "admin/organization/pricing_plan_utils"; | ||||||||
import { BoundingBoxType, Vector3 } from "oxalis/constants"; | ||||||||
import { BoundingBoxType, ControlModeEnum, Vector3 } from "oxalis/constants"; | ||||||||
import BoundingBox from "oxalis/model/bucket_data_handling/bounding_box"; | ||||||||
import { Model } from "oxalis/singletons"; | ||||||||
import { BoundingBoxSelection, LayerSelection } from "./starting_job_modals"; | ||||||||
|
||||||||
type Props = { | ||||||||
|
@@ -80,7 +82,10 @@ export function CreateAnimationModalWrapper(props: Props) { | |||||||
|
||||||||
// early stop if no color layer exists | ||||||||
const colorLayers = getColorLayers(dataset); | ||||||||
if (colorLayers.length === 0) return null; | ||||||||
if (colorLayers.length === 0) { | ||||||||
console.warn("WK can not create animations for datasets without color layers."); | ||||||||
philippotto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
return null; | ||||||||
} | ||||||||
|
||||||||
return <CreateAnimationModal {...props} />; | ||||||||
} | ||||||||
|
@@ -128,7 +133,7 @@ function CreateAnimationModal(props: Props) { | |||||||
const validateAnimationOptions = ( | ||||||||
colorLayer: APIDataLayer, | ||||||||
selectedBoundingBox: BoundingBoxType, | ||||||||
meshSegmentIds: number[], | ||||||||
meshes: Partial<MeshInformation>[], | ||||||||
) => { | ||||||||
// Validate the select parameters and dataset to make sure it actually works and does not overload the server | ||||||||
|
||||||||
|
@@ -151,7 +156,7 @@ function CreateAnimationModal(props: Props) { | |||||||
!is2dDataset(state.dataset) && (colorLayer.additionalAxes?.length || 0) === 0; | ||||||||
if (isDataset3D) errorMessages.push("Sorry, animations are only supported for 3D datasets."); | ||||||||
|
||||||||
const isTooManyMeshes = meshSegmentIds.length > MAX_MESHES_PER_ANIMATION; | ||||||||
const isTooManyMeshes = meshes.length > MAX_MESHES_PER_ANIMATION; | ||||||||
if (isTooManyMeshes) | ||||||||
errorMessages.push( | ||||||||
`You selected too many meshes for the animation. Please keep the number of meshes below ${MAX_MESHES_PER_ANIMATION} to create an animation.`, | ||||||||
|
@@ -171,32 +176,34 @@ function CreateAnimationModal(props: Props) { | |||||||
(bb) => bb.id === selectedBoundingBoxId, | ||||||||
)!.boundingBox; | ||||||||
|
||||||||
// Submit currently visible pre-computed meshes | ||||||||
let meshSegmentIds: number[] = []; | ||||||||
let meshFileName: string | undefined; | ||||||||
let segmentationLayerName: string | undefined; | ||||||||
|
||||||||
const visibleSegmentationLayer = Model.getVisibleSegmentationLayer(); | ||||||||
|
||||||||
if (visibleSegmentationLayer) { | ||||||||
const availableMeshes = state.localSegmentationData[visibleSegmentationLayer.name].meshes; | ||||||||
if (availableMeshes == null) { | ||||||||
throw new Error("There is no mesh data in localSegmentationData."); | ||||||||
} | ||||||||
meshSegmentIds = Object.values(availableMeshes as Record<number, MeshInformation>) | ||||||||
.filter((mesh) => mesh.isVisible && mesh.isPrecomputed) | ||||||||
.map((mesh) => mesh.segmentId); | ||||||||
|
||||||||
const currentMeshFile = | ||||||||
state.localSegmentationData[visibleSegmentationLayer.name].currentMeshFile; | ||||||||
meshFileName = currentMeshFile?.meshFileName; | ||||||||
|
||||||||
if (visibleSegmentationLayer.fallbackLayerInfo) { | ||||||||
segmentationLayerName = visibleSegmentationLayer.fallbackLayerInfo.name; | ||||||||
} else { | ||||||||
segmentationLayerName = visibleSegmentationLayer.name; | ||||||||
} | ||||||||
} | ||||||||
// Submit currently visible pre-computed & ad-hoc meshes | ||||||||
const axis = ""; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
would be a bit cleaner. |
||||||||
const layerNames = Object.keys(state.localSegmentationData); | ||||||||
const { preferredQualityForMeshAdHocComputation } = state.temporaryConfiguration; | ||||||||
|
||||||||
const meshes: RenderAnimationOptions["meshes"] = layerNames.flatMap((layerName) => { | ||||||||
const meshInfos = state.localSegmentationData[layerName]?.meshes?.[axis] || {}; | ||||||||
|
||||||||
return Object.values(meshInfos) | ||||||||
.filter((meshInfo: MeshInformation) => meshInfo.isVisible) | ||||||||
.flatMap((meshInfo: MeshInformation) => { | ||||||||
const layer = getLayerByName(state.dataset, layerName) as APISegmentationLayer; | ||||||||
const hasAFallbackLayer = hasFallbackLayer(layer); | ||||||||
const fullLayerName = layer.fallbackLayerInfo?.name || layerName; | ||||||||
|
||||||||
const adhoc_mag_index = getResolutionInfo(layer.resolutions).getClosestExistingIndex( | ||||||||
preferredQualityForMeshAdHocComputation, | ||||||||
); | ||||||||
const adhoc_mag = layer.resolutions[adhoc_mag_index]; | ||||||||
philippotto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
return { | ||||||||
layerName: fullLayerName, | ||||||||
hasFallbackLayer: hasAFallbackLayer, | ||||||||
adhoc_mag, | ||||||||
...meshInfo, | ||||||||
}; | ||||||||
}); | ||||||||
}); | ||||||||
|
||||||||
// Submit the configured min/max intensity info to support float datasets | ||||||||
const [intensityMin, intensityMax] = getEffectiveIntensityRange( | ||||||||
|
@@ -206,22 +213,22 @@ function CreateAnimationModal(props: Props) { | |||||||
); | ||||||||
|
||||||||
const [magForTextures, _] = selectMagForTextureCreation(colorLayer, boundingBox); | ||||||||
const isViewMode = state.temporaryConfiguration.controlMode === ControlModeEnum.VIEW; | ||||||||
|
||||||||
const animationOptions: RenderAnimationOptions = { | ||||||||
layerName: selectedColorLayerName, | ||||||||
segmentationLayerName, | ||||||||
meshFileName, | ||||||||
meshSegmentIds, | ||||||||
colorLayerName: selectedColorLayerName, | ||||||||
meshes, | ||||||||
intensityMin, | ||||||||
intensityMax, | ||||||||
magForTextures, | ||||||||
isViewMode, | ||||||||
boundingBox: computeBoundingBoxObjectFromBoundingBox(boundingBox), | ||||||||
includeWatermark: isWatermarkEnabled, | ||||||||
movieResolution: selectedMovieResolution, | ||||||||
cameraPosition: selectedCameraPosition, | ||||||||
}; | ||||||||
|
||||||||
if (!validateAnimationOptions(colorLayer, boundingBox, meshSegmentIds)) return; | ||||||||
if (!validateAnimationOptions(colorLayer, boundingBox, meshes)) return; | ||||||||
|
||||||||
startRenderAnimationJob(state.dataset.owningOrganization, state.dataset.name, animationOptions); | ||||||||
|
||||||||
|
@@ -338,7 +345,7 @@ function CreateAnimationModal(props: Props) { | |||||||
> | ||||||||
Include the currently selected 3D meshes | ||||||||
<Tooltip | ||||||||
title="When enabled, all (pre-computed) meshes currently visible in WEBKNOSSOS will be included in the animation." | ||||||||
title="When enabled, all meshes currently visible in WEBKNOSSOS will be included in the animation." | ||||||||
placement="right" | ||||||||
> | ||||||||
<InfoCircleOutlined style={{ marginLeft: 10 }} /> | ||||||||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that if the command args change, the job list view code in the frontend also needs to be adapted (currently the existing layer_name is used to render the job description. compare also getJobs in admin_rest_api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to ensure backwards compatibility for this job list view rendering (or migrate old jobs in postgres)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I wasn't aware of this connection... will undo the renaming then.