Commit 95067144 authored by Amandine  TOURNAY's avatar Amandine TOURNAY
Browse files

Added project

parent 4b4f6eee
.idea/
target/
.settings/
*.iml
.project
.classpath
\ No newline at end of file
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="Stack Rotation/StackRotation.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/Stack Rotation/export.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="true" manifestLocation="/Icy-Updater/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
<javaElement handleIdentifier="=Stack Rotation/src"/>
</selectedElements>
</jardesc>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Inherited Icy Parent POM -->
<parent>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>parent-pom-plugin</artifactId>
<version>1.0.3</version>
</parent>
<!-- Project Information -->
<artifactId>stack-rotation</artifactId>
<version>1.2.1</version>
<packaging>jar</packaging>
<name>Stack Rotation</name>
<description>Rotate the 3D stack from Front view to Right view or from Front view to Top view. </description>
<url></url>
<inceptionYear>2020</inceptionYear>
<organization>
<name>Institut Pasteur</name>
<url>https://pasteur.fr</url>
</organization>
<licenses>
<license>
<name>GNU GPLv3</name>
<url>https://www.gnu.org/licenses/gpl-3.0.en.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>sdallongeville</id>
<name>Stéphane Dallongeville</name>
<url>https://research.pasteur.fr/fr/member/stephane-dallongeville/</url>
<roles>
<role>founder</role>
<role>lead</role>
<role>architect</role>
<role>developer</role>
<role>debugger</role>
<role>tester</role>
<role>maintainer</role>
<role>support</role>
</roles>
</developer>
</developers>
<!-- Project properties -->
<properties>
</properties>
<!-- Project build configuration -->
<build>
</build>
<!-- List of project's dependencies -->
<dependencies>
<!-- The core of Icy -->
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>icy-kernel</artifactId>
</dependency>
<!-- The EzPlug library, simplifies writing UI for Icy plugins. -->
<dependency>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>ezplug</artifactId>
</dependency>
</dependencies>
<!-- Icy Maven repository (to find parent POM) -->
<repositories>
<repository>
<id>icy</id>
<name>Icy's Nexus</name>
<url>https://icy-nexus.pasteur.fr/repository/Icy/</url>
</repository>
</repositories>
</project>
\ No newline at end of file
package plugins.spop.rotation3D;
import icy.image.IcyBufferedImage;
import icy.sequence.Sequence;
import icy.type.collection.array.Array1DUtil;
import icy.util.OMEUtil;
import plugins.adufour.blocks.lang.Block;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.ezplug.EzPlug;
import plugins.adufour.ezplug.EzVarSequence;
import plugins.adufour.ezplug.EzVarText;
public class StackRotation extends EzPlug implements Block
{
EzVarSequence input = new EzVarSequence("Input");
EzVarText type = new EzVarText("Type", new String[] { "FrontToRight", "FrontToTop" }, false);
// VarSequence output = new VarSequence("Output", false);
EzVarSequence output = new EzVarSequence("Output");
@Override
public void initialize()
{
// TODO Auto-generated method stub
super.addEzComponent(input);
super.addEzComponent(type);
// super.addOutput(output);
super.setTimeDisplay(true);
}
@Override
public void execute()
{
Sequence sequence = input.getValue(true);
Sequence seq_out = new Sequence(OMEUtil.createOMEXMLMetadata(sequence.getOMEXMLMetadata()));
if (type.getValue().equalsIgnoreCase("FrontToRight"))
{
seq_out = FrontToRight(sequence);
seq_out.setName("FrontToRight");
}
if (type.getValue().equalsIgnoreCase("FrontToTop"))
{
seq_out = FrontToTop(sequence);
seq_out.setName("FrontToTop");
}
if (getUI() != null) addSequence(seq_out);
output.setValue(seq_out);
}
public static Sequence FrontToRight(Sequence sequence)
{
int z = 0;
Sequence seq = new Sequence();
int dim_x = sequence.getSizeX();
int dim_y = sequence.getSizeY();
int dim_z = sequence.getSizeZ();
int dim_t = sequence.getSizeT();
int dim_c = sequence.getSizeC();
double[][] tab = new double[dim_z][dim_x * dim_y];
double[][][] tab_r = new double[dim_c][dim_x][dim_y * dim_z];
for (int t = 0; t < dim_t; t++)
{
for (int c = 0; c < dim_c; c++)
{
for (z = 0; z < dim_z; z++)
{
tab[z] = Array1DUtil.arrayToDoubleArray(sequence.getDataXY(t, z, c), false);
}
for (z = 0; z < dim_z; z++)
for (int y = 0; y < dim_y; y++)
for (int x = 0; x < dim_x; x++)
{
tab_r[c][x][y * dim_z + z] = tab[z][y * dim_x + x];
}
}
for (z = 0; z < dim_x; z++)
{
IcyBufferedImage Icy = new IcyBufferedImage(dim_z, dim_y, dim_c, sequence.getDataType());
for (int c = 0; c < dim_c; c++)
Icy.setDataXY(c, tab_r[c][z]);
seq.setImage(t, z, Icy);
}
}
System.gc();
return seq;
}
public static Sequence FrontToTop(Sequence sequence)
{
int z = 0;
Sequence seq = new Sequence();
int dim_x = sequence.getSizeX();
int dim_y = sequence.getSizeY();
int dim_z = sequence.getSizeZ();
int dim_t = sequence.getSizeT();
int dim_c = sequence.getSizeC();
double[][] tab = new double[dim_z][dim_x * dim_y];
double[][][] tab_r = new double[dim_c][dim_y][dim_x * dim_z];
for (int t = 0; t < dim_t; t++)
{
for (int c = 0; c < dim_c; c++)
{
for (z = 0; z < dim_z; z++)
{
tab[z] = Array1DUtil.arrayToDoubleArray(sequence.getDataXY(t, z, c), false);
}
for (z = 0; z < dim_z; z++)
for (int y = 0; y < dim_y; y++)
for (int x = 0; x < dim_x; x++)
{
tab_r[c][y][z * dim_x + x] = tab[z][y * dim_x + x];
}
}
for (z = 0; z < dim_y; z++)
{
IcyBufferedImage Icy = new IcyBufferedImage(dim_x, dim_z, dim_c, sequence.getDataType());
for (int c = 0; c < dim_c; c++)
Icy.setDataXY(c, tab_r[c][z]);
seq.setImage(t, z, Icy);
}
}
System.gc();
return seq;
}
public void clean()
{
}
@Override
public void declareInput(VarList inputMap)
{
// TODO Auto-generated method stub
inputMap.add(input.getVariable());
inputMap.add(type.getVariable());
}
@Override
public void declareOutput(VarList outputMap)
{
// TODO Auto-generated method stub
outputMap.add(output.getVariable());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment