-
Notifications
You must be signed in to change notification settings - Fork 1.4k
144 loadnifti transform common dataset #145
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ede726e
[DLMED] add LoadNifti transform and common Dataset
Nic-Ma 5969d7c
Merge branch 'master' into 144-loadnifti-transform-common-dataset
Nic-Ma c11112b
[DLMED] update according to comments
Nic-Ma 852ef7e
[DLMED] fix typo
Nic-Ma 01ede78
[DLMED] update example to use latest API
Nic-Ma 4c6b65b
[DLMED] update code to add more features
Nic-Ma 5e03be1
Merge branch 'master' into 144-loadnifti-transform-common-dataset
Nic-Ma 96e60c1
[DLMED] update to AsChannelFirst
Nic-Ma bfe75a3
[DLMED] update to use np.moveaxis API instead
Nic-Ma b620fcb
[DLMED] update according to comments
Nic-Ma f1b5c22
Merge branch 'master' into 144-loadnifti-transform-common-dataset
Nic-Ma 960a834
Merge branch 'master' into 144-loadnifti-transform-common-dataset
wyli 225f34f
update generalized dice to be consistent with the changes in dice loss
wyli 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 hidden or 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 hidden or 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,45 @@ | ||
| # Copyright 2020 MONAI Consortium | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import torch | ||
| from monai.utils.module import export | ||
|
|
||
|
|
||
| @export("monai.data") | ||
| class Dataset(torch.utils.data.Dataset): | ||
| """ | ||
| General Dataset to handle dictionary format data, it can operate transforms for specific fields. | ||
| For example, typical input data can be a list of dictionaries: | ||
| [{ { { | ||
| 'img': 'image1.nii.gz', 'img': 'image2.nii.gz', 'img': 'image3.nii.gz', | ||
Nic-Ma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'seg': 'label1.nii.gz', 'seg': 'label2.nii.gz', 'seg': 'label3.nii.gz', | ||
| 'extra': 123 'extra': 456 'extra': 789 | ||
| }, }, }] | ||
| """ | ||
|
|
||
| def __init__(self, data, transform=None): | ||
| """ | ||
| Args: | ||
| data (Iterable): input data to load and transform to generate dataset for model. | ||
| transform (Callable, optional): transforms to excute operations on input data. | ||
| """ | ||
| self.data = data | ||
| self.transform = transform | ||
|
|
||
| def __len__(self): | ||
| return len(self.data) | ||
|
|
||
| def __getitem__(self, index): | ||
| data = self.data[index] | ||
| if self.transform is not None: | ||
| data = self.transform(data) | ||
|
|
||
| return data | ||
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.