-
Notifications
You must be signed in to change notification settings - Fork 326
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
feat(surface rendering): Add surface rendering as segmentation representation #808
Merged
sedghi
merged 37 commits into
cornerstonejs:main
from
RadicalImaging:feat/surface-segmentation-2
Oct 19, 2023
+537,167
−149
Merged
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
0978f17
feat: add surface segmentation representation
sedghi 86b8f81
fix examples
sedghi 7214c35
revert
sedghi c849e78
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into fe…
sedghi 095d5eb
rename
sedghi b4c4216
webpack
sedghi f3845b8
webpack
sedghi 193c34c
Add surface clipping via filter
rodrigobasilio2022 4a5014e
Reset camera clipping range
rodrigobasilio2022 862bb8a
refactor how viewport updates clipping planes
rodrigobasilio2022 28f2dc5
Add polydata cache
rodrigobasilio2022 9bfd377
Add event for clipping planes update
rodrigobasilio2022 c48c39f
Stack surface example created
rodrigobasilio2022 cc3411e
Refactor imageSlice creation
rodrigobasilio2022 7023837
fix polydata not showing in stack
rodrigobasilio2022 07a4da4
Adding a RT stack example
rodrigobasilio2022 8964f7f
Create SegmentationIntersectionTool
rodrigobasilio2022 6f00829
fix
sedghi 022939a
Remove duplicate points
rodrigobasilio2022 8f3ad71
Fix color bug and remove duplicate points
rodrigobasilio2022 3ada3e2
Fix bug multiple polylines
rodrigobasilio2022 3d0c578
Refactor unwanted canAdded planes variable
rodrigobasilio2022 3492cd5
Restore file
rodrigobasilio2022 350c91b
Add comments in changed files
rodrigobasilio2022 1a87432
minor refactoring to build and update api
rodrigobasilio2022 48d7e55
Fix minor regression bug
rodrigobasilio2022 8d85975
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into pr…
sedghi 0ea6c17
cleanup
sedghi d75e8f8
wip
sedghi 080cadc
wip
sedghi 0bfff5a
cleanup
sedghi b0e116d
fix the performance issue with zoom and pan revisiting same slice
sedghi 0bdc040
fix reconstructed views
sedghi d0119f1
api
sedghi 654c455
demo
sedghi 57d0833
doc
sedghi 62f3e44
fix vtk actors
sedghi 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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { SurfaceData, Point3 } from '../../types'; | ||
|
||
type SurfaceProps = { | ||
id: string; | ||
data: SurfaceData; | ||
frameOfReferenceUID: string; | ||
color?: Point3; | ||
}; | ||
|
||
/** | ||
* Surface class for storing surface data | ||
*/ | ||
export class Surface { | ||
readonly id: string; | ||
readonly sizeInBytes: number; | ||
readonly frameOfReferenceUID: string; | ||
private color: Point3 = [200, 0, 0]; // default color | ||
private points: number[]; | ||
private polys: number[]; | ||
|
||
constructor(props: SurfaceProps) { | ||
this.id = props.id; | ||
this.points = props.data.points; | ||
this.polys = props.data.polys; | ||
this.color = props.color ?? this.color; | ||
this.frameOfReferenceUID = props.frameOfReferenceUID; | ||
this.sizeInBytes = this._getSizeInBytes(); | ||
} | ||
|
||
_getSizeInBytes(): number { | ||
return this.points.length * 4 + this.polys.length * 4; | ||
} | ||
|
||
public getColor(): Point3 { | ||
return this.color; | ||
} | ||
|
||
public getPoints(): number[] { | ||
return this.points; | ||
} | ||
|
||
public getPolys(): number[] { | ||
return this.polys; | ||
} | ||
|
||
public getSizeInBytes(): number { | ||
return this.sizeInBytes; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
enum GeometryType { | ||
CONTOUR = 'contour', | ||
SURFACE = 'Surface', | ||
} | ||
|
||
export default GeometryType; |
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
28 changes: 28 additions & 0 deletions
28
packages/core/src/loaders/utils/contourSet/createContourSet.ts
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,28 @@ | ||
import { IGeometry, PublicContourSetData } from '../../../types'; | ||
import { GeometryType } from '../../../enums'; | ||
import { validateContourSet } from './validateContourSet'; | ||
import { ContourSet } from '../../../cache/classes/ContourSet'; | ||
|
||
export function createContourSet( | ||
geometryId: string, | ||
contourSetData: PublicContourSetData | ||
) { | ||
// validate the data to make sure it is a valid contour set | ||
validateContourSet(contourSetData); | ||
|
||
const contourSet = new ContourSet({ | ||
id: contourSetData.id, | ||
data: contourSetData.data, | ||
color: contourSetData.color, | ||
frameOfReferenceUID: contourSetData.frameOfReferenceUID, | ||
}); | ||
|
||
const geometry: IGeometry = { | ||
id: geometryId, | ||
type: GeometryType.CONTOUR, | ||
data: contourSet, | ||
sizeInBytes: contourSet.getSizeInBytes(), | ||
}; | ||
|
||
return geometry; | ||
} |
Oops, something went wrong.
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.
what is async here that you need an await?
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.
Because if we remove the await, the 3d volume render will not correctly call the renderer.resetCameraClippingRange();
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.
But which part of the the inner functions is asynchronous? Do you know?
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.
Yes I understand what you are saying... I really dont know.... Any of these functionas appears to be the one. I remember if I removed this await if will not render correctly the volumeViewport3D. Maybe you can do this test again...