Skip to content
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 add generate segmentation from dataset #153

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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: 2 additions & 2 deletions src/adapters/Cornerstone/Segmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ function fillSegmentation(
* @returns {Blob} description
*/
function generateSegmentationFromDatasets(
dataset,
datasets,
inputLabelmaps3D,
options = { includeSliceSpacing: true },
cornerstoneToolsVersion = 4
) {
if (cornerstoneToolsVersion === 4) {
return Segmentation_4X.generateSegmentationFromDatasets(
dataset,
datasets,
inputLabelmaps3D,
options
);
Expand Down
3 changes: 2 additions & 1 deletion src/adapters/Cornerstone/Segmentation_4X.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function generateSegmentationFromDatasets(
inputLabelmaps3D,
userOptions = {}
) {
//on multiframe images, datasets array contains only 1 element but should work as well
//make sure _meta property is present in every element of datasets with at least an empty array
datasets = datasets.map(ds => ({ ...ds, _meta: ds._meta || [] }));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi - thanks for this, I'm trying to get my head back into the details.

Wouldn't we get the same effect more generally if this line where changed to:

_meta: this.referencedDataset._meta || []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Pieper,

Yes, much better. Thanks

const multiframe = Normalizer.normalizeToDataset(datasets);
const segmentation = new SegmentationDerivation([multiframe], userOptions);
return fillSegmentation(segmentation, inputLabelmaps3D, userOptions);
Expand Down