-
Notifications
You must be signed in to change notification settings - Fork 3
Projection op improvments #293
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
6 commits
Select commit
Hold shift + click to select a range
426552b
Widen projection op input
gselzer e59977d
Ensure projection within provided interval
gselzer 2138118
Expand on Project Ops
gselzer 1e5c4e3
Clean up comments
gselzer 52c11f4
Use Ops for slicing
gselzer cad5161
Use interval instead
gselzer 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
59 changes: 59 additions & 0 deletions
59
...rc/main/java/org/scijava/ops/image/transform/project/project/ProjectParallelFunction.java
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,59 @@ | ||
| package org.scijava.ops.image.transform.project.project; | ||
|
|
||
| import net.imglib2.FinalDimensions; | ||
| import net.imglib2.RandomAccessibleInterval; | ||
| import org.scijava.function.Computers; | ||
| import org.scijava.function.Functions; | ||
| import org.scijava.function.Producer; | ||
| import org.scijava.ops.spi.OpDependency; | ||
|
|
||
| import java.util.function.BiFunction; | ||
|
|
||
| /** | ||
| * Wraps {@link ProjectParallelComputer}, but creates a new output image in the process. | ||
| * @param <T> the type of input image elements | ||
| * @param <V> the type of output image elements | ||
| * @author Gabriel Selzer | ||
| * @implNote op name='transform.project', priority='99.' | ||
| */ | ||
| public class ProjectParallelFunction<T, V> implements | ||
| Functions.Arity3<RandomAccessibleInterval<T>, Computers.Arity1<? super RandomAccessibleInterval<T>, V>, Integer, RandomAccessibleInterval<V>> | ||
| { | ||
| @OpDependency(name="transform.project") | ||
| Computers.Arity3<RandomAccessibleInterval<T>, Computers.Arity1<? super RandomAccessibleInterval<T>, V>, Integer, RandomAccessibleInterval<V>> projector; | ||
|
|
||
| @OpDependency(name="transform.translateView") | ||
| BiFunction<RandomAccessibleInterval<V>, long[], RandomAccessibleInterval<V>> translator; | ||
|
|
||
| @OpDependency(name="create.type") | ||
| Producer<V> typeCreator; | ||
|
|
||
| @OpDependency(name="create.img") | ||
| BiFunction<FinalDimensions, V, RandomAccessibleInterval<V>> creator; | ||
|
|
||
|
|
||
| /** | ||
| * Projects {@code op} along 1-dimensional slices (along dimension {@code dim}) of {@code input} | ||
| * | ||
| * @param input the input {@code n}-dimensional dataset | ||
| * @param op the Op to project over {@code dim} | ||
| * @param dim the dimension along {@code input} to project | ||
| * @return a {@code n-1}-dimensional dataset | ||
| */ | ||
| @Override | ||
| public RandomAccessibleInterval<V> apply(RandomAccessibleInterval<T> input, Computers.Arity1<? super RandomAccessibleInterval<T>, V> op, Integer dim) { | ||
| var dims = new long[input.numDimensions() - 1]; | ||
| var min = new long[input.numDimensions() - 1]; | ||
| for(int i = 0; i < input.numDimensions() - 1; i++) { | ||
| dims[i] = input.dimension(i >= dim ? i+1 : i); | ||
| min[i] = input.min(i >= dim ? i+1 : i); | ||
| } | ||
| // Get an arbitrary instance of the output type | ||
| var outImg = creator.apply(new FinalDimensions(dims), typeCreator.create()); | ||
| // translate by the minimum of the input img | ||
| var translated = translator.apply(outImg, min); | ||
|
|
||
| projector.compute(input, op, dim, translated); | ||
| return translated; | ||
| } | ||
| } | ||
122 changes: 0 additions & 122 deletions
122
...in/java/org/scijava/ops/image/transform/project/project/ProjectRAIToIterableInterval.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.