-
Notifications
You must be signed in to change notification settings - Fork 6
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
add merge ROIs feature #9
base: main
Are you sure you want to change the base?
Changes from 5 commits
41f57eb
f64faa0
1ddb0bf
97b6e30
5d4e9c2
d7af28b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,33 @@ | |
|
||
mask = createRoiLabel(mask); | ||
|
||
case 'merge' | ||
|
||
roiImages = specification; | ||
|
||
% loop through the ROIs to merge | ||
for iRoi = 1:length(roiImages) | ||
% load one ROI per time | ||
maskToMerge = load_untouch_nii(roiImages{iRoi}); | ||
% take the first ROI as reference to add the others to it | ||
if iRoi == 1 | ||
mask = maskToMerge; | ||
% delete the fileprefix argument to be re-assigned with the new one | ||
mask.fileprefix = []; | ||
else | ||
% sum up the ROI masks | ||
mask.img = mask.img + maskToMerge.img; | ||
end | ||
|
||
end | ||
|
||
% check that there are no >1s | ||
mask.img(mask.img > 1) = 1; | ||
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. I am pretty sure that in this case you can just convert mask.img to a logical array:
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. I think that using
will save us from having values >1 although, maybe for the future, we would like to have different values for each single single ROI merged 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. If you mean having a single image that combines different masks has a different "label" for each ROI: I agree but I would have that as an entirely different function. |
||
|
||
% assign fileprefix (name to be save?) | ||
% [ WIP ] | ||
mask = createRoiLabel(mask); | ||
|
||
case 'expand' | ||
|
||
% Ugly hack | ||
|
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 are still developping this but I suspect we'll want to have the same way to use specification for all "cases":
so that it will be something like :
not necessary to have now but just to let you know that the "API" and the type and name of arguments for this function are still a moving target. :-)
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.
not sure if this replys to it but in a batch file you would have eg
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.
More like this