Mercurial > repos > imgteam > repeat_channels
annotate repeat_channels.py @ 0:7cdb50fee601 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
| author | imgteam |
|---|---|
| date | Thu, 25 Apr 2024 10:57:53 +0000 |
| parents | |
| children |
| rev | line source |
|---|---|
|
0
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
1 import argparse |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
2 |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
3 import giatools.io |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
4 import numpy as np |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
5 import skimage.io |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
6 |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
7 |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
8 if __name__ == '__main__': |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
9 |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
10 parser = argparse.ArgumentParser() |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
11 parser.add_argument('input', type=str) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
12 parser.add_argument('count', type=int) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
13 parser.add_argument('output', type=str) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
14 args = parser.parse_args() |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
15 |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
16 im = giatools.io.imread(args.input) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
17 im = np.squeeze(im) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
18 im = np.dstack([im] * args.count) |
|
7cdb50fee601
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
imgteam
parents:
diff
changeset
|
19 skimage.io.imsave(args.output, im) |
