Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Zellige-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IdA Public
Zellige-core
Commits
58d126ca
Commit
58d126ca
authored
2 years ago
by
Céline TREBEAU
Browse files
Options
Downloads
Patches
Plain Diff
- Addition of new class to select the channel for the surface extraction
parent
cf76cc00
No related branches found
No related tags found
1 merge request
!40
Draft: Resolve "Multi-channel image handling"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/pasteur/ida/zellige/steps/ChannelImageSelection.java
+59
-0
59 additions, 0 deletions
...a/fr/pasteur/ida/zellige/steps/ChannelImageSelection.java
with
59 additions
and
0 deletions
src/main/java/fr/pasteur/ida/zellige/steps/ChannelImageSelection.java
0 → 100644
+
59
−
0
View file @
58d126ca
package
fr.pasteur.ida.zellige.steps
;
import
net.imagej.Dataset
;
import
net.imagej.ImgPlus
;
import
net.imglib2.RandomAccess
;
import
net.imglib2.img.Img
;
import
net.imglib2.type.NativeType
;
import
net.imglib2.type.numeric.RealType
;
public
class
ChannelImageSelection
<
T
extends
RealType
<
T
>
&
NativeType
<
T
>
>
{
private
final
int
targetChannel
;
private
final
Dataset
dataset
;
public
static
<
T
extends
RealType
<
T
>
&
NativeType
<
T
>
>
Img
<
T
>
run
(
Dataset
input
,
int
targetChannel
)
{
ChannelImageSelection
<
T
>
channelImageSelection
=
new
ChannelImageSelection
<>(
input
,
targetChannel
);
return
channelImageSelection
.
run
();
}
public
ChannelImageSelection
(
Dataset
dataset
,
int
targetChannel
)
{
this
.
targetChannel
=
targetChannel
;
this
.
dataset
=
dataset
;
}
public
Img
<
T
>
run
()
{
Img
<
T
>
input
=
(
ImgPlus
<
T
>
)
this
.
dataset
.
getImgPlus
();
if
(
getTargetChannel
()
==
0
)
{
return
input
;
}
else
{
Img
<
T
>
output
=
input
.
factory
().
create
(
input
.
dimension
(
0
),
input
.
dimension
(
1
),
input
.
dimension
(
3
)
);
RandomAccess
<
T
>
randomAccess
=
input
.
randomAccess
();
RandomAccess
<
T
>
randomAccess1
=
output
.
randomAccess
();
for
(
int
x
=
0
;
x
<
(
int
)
input
.
dimension
(
0
);
x
++
)
{
for
(
int
y
=
0
;
y
<
(
int
)
input
.
dimension
(
1
);
y
++
)
{
for
(
int
z
=
0
;
z
<
(
int
)
input
.
dimension
(
3
);
z
++
)
{
randomAccess
.
setPositionAndGet
(
x
,
y
,
getTargetChannel
()-
1
,
z
);
randomAccess1
.
setPosition
(
new
int
[]{
x
,
y
,
z
}
);
randomAccess1
.
get
().
set
(
randomAccess
.
get
()
);
}
}
}
return
output
;
}
}
public
int
getTargetChannel
()
{
return
targetChannel
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment