Skip to content
Snippets Groups Projects

Draft: Plugin classes

Closed Céline TREBEAU requested to merge dev-plugin into dev
14 files
+ 1625
0
Compare changes
  • Side-by-side
  • Inline
Files
14
+ 108
0
import ij.ImageJ;
import io.scif.img.IO;
import io.scif.img.SCIFIOImgPlus;
import net.imglib2.img.Img;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.TreeMap;
public class StartingOSStats
{
BufferedWriter writer;
FileWriter fileWriter;
private final String path = "C:\\Users\\ctrebeau\\Desktop\\stats\\";
public StartingOSStats( String fileName ) throws IOException
{
fileName.replace( "tif", "txt" );
writer = new BufferedWriter(new FileWriter(fileName));
writer.write(path + fileName );
}
public void writeParameter(String amplitude, String otsu, String sigmas, String delta) throws IOException
{
StringBuilder s = new StringBuilder(
"Amplitude percent : " + amplitude +
"Otsu percent : " +otsu + System.lineSeparator() +
"Sigmas : " + sigmas + System.lineSeparator()+
"Delta : " + delta + System.lineSeparator());
writer.write( s.toString() );
}
public void close() throws IOException
{
writer.close();
}
public void writeHistogram( TreeMap<Integer, Integer> map ) throws IOException
{
writer.write(map.toString());
}
public void writeInfo( String info, double value) throws IOException
{
writer.write( info + " : " + value );
}
public static < T extends RealType< T > & NativeType< T > > void main( String[] args ) throws IOException
{
String path = "C:\\Users\\ctrebeau\\Desktop\\MoucheAile\\STK\\";
String fileName = "STK_Mouche_c01_f0001_p005.tif";
// Input of the image.
final String imagePath = path + fileName;
// "doc/BG2.tif";
System.out.println("File : " + fileName );
ImageJ ij = new ImageJ();
/* JY version for opening files. */
final SCIFIOImgPlus< ? > imgPlus = IO.openImgs( imagePath ).get( 0 );
final Img< T > stackImage = ( Img < T > ) imgPlus.getImg();
/* User Parameters AKA arguments to run the program*/
double amplitude = Double.parseDouble( args[ 0 ] );
double otsu = Double.parseDouble( args[ 1 ] );
int sigmas = Integer.parseInt( args[ 2 ] );
int k1 = Integer.parseInt( args[ 3 ] );
double percent1 = Double.parseDouble( args[ 4 ] );
int k2 = Integer.parseInt( args[ 5 ] );
double percent2 = Double.parseDouble( args[ 6 ] );
int delta = Integer.parseInt( args[ 7 ] );
/* End of parameters. */
// UserParameters userParameters = new UserParameters( amplitude, otsu, sigmas, delta, "MIP", 0 );
// AdvancedUserParameters advancedUserParameters = new AdvancedUserParameters( k1, percent1, k2, percent2 );
//
// IJ.log("Type: "+ imgPlus.firstElement().getClass().toGenericString());
//
// if ( stackImage.numDimensions() == 3 )// Is it a stack ?
// {
//// ImageJFunctions.show( stackImage, "original" );
//// ImageJFunctions.show( TestMIP.findMIP( stackImage, stackImage.factory() ), "MIP" );
// new ReferenceSurfaceExtraction<>( stackImage, stackImage.factory(),userParameters, advancedUserParameters );
// }
// else
// {
// System.out.println( " This image has to be a z-stack ! " );
// }
// StartingOSStats startingOSStats = new StartingOSStats( fileName );
// startingOSStats.writeParameter( args[ 0 ] , args[ 1 ] , args[ 2 ], args[ 3 ] );
// startingOSStats.writeInfo( "OS count ", OSE.getCount() );
//// startingOSStats.writeHistogram( OSE.getOcc() );
// startingOSStats.close();
}
}
Loading