Commit 4bdd4cd8 authored by Andrey Filippov's avatar Andrey Filippov

Cleaning up

parent 064ff7ca
......@@ -1221,7 +1221,7 @@ public class PixelMapping {
if (saveTiff){
String outPath=((resultDirectory.length()<1)?"":(resultDirectory+Prefs.getFileSeparator()))+impOverlap.getTitle()+".tiff";
try {
(new EyesisTiff()).saveTiff(
EyesisTiff.saveTiff(
impOverlap,
outPath,
3, // float32
......
......@@ -2743,7 +2743,7 @@ public class EyesisCorrections {
try {
(new EyesisTiff()).saveTiffARGB32(
imp,
path, // +".tiff",
path+".tiff", //path, // +".tiff",
false, // correctionsParameters.imageJTags,
debugLevel);
} catch (IOException e) {
......
......@@ -295,7 +295,7 @@ the type of pixel data in this file getPixelType()
public void saveTiff(
public static void saveTiff(
ImagePlus imp,
String path,
int mode, // 0 - 8-bit, 1 - 16-bit, 2 - 32-bit unsigned, 3 - 32FP (only if source image is a 4-stack of FP)
......@@ -316,7 +316,7 @@ the type of pixel data in this file getPixelType()
IJ.showMessage("Not yet implemented for this image type");
}
public void saveTiffARGB(
public static void saveTiffARGB(
ImagePlus imp,
String path,
int mode, // 0 - 8-bit, 1 - 16-bit, 2 - 32-bit unsigned, 3 - 32FP (only if source image is a 4-stack of FP)
......@@ -428,12 +428,14 @@ the type of pixel data in this file getPixelType()
return;
}
// System.out.println("saveTiffARGBFloat32(): mode="+mode+" pixelType="+pixelType+" bw="+bw);
// ExifGPSTagSet gps_set = new ExifGPSTagSet();
// EXIFGPSTagSet gps_set = new EXIFGPSTagSet();
IFD ifd=new IFD();
ifd.put(new Integer(IFD.LITTLE_ENDIAN), new Boolean(false));
ifd.put(IFD.LITTLE_ENDIAN, false);
// ifd.put(new Integer(IFD.LITTLE_ENDIAN), new Boolean(true));
ifd.put(new Integer(IFD.IMAGE_WIDTH), imp.getWidth());
ifd.put(new Integer(IFD.IMAGE_LENGTH), imp.getHeight());
ifd.put(new Integer(IFD.SAMPLES_PER_PIXEL), 4);
ifd.put(IFD.IMAGE_WIDTH, imp.getWidth());
ifd.put(IFD.IMAGE_LENGTH, imp.getHeight());
ifd.put(IFD.SAMPLES_PER_PIXEL, 4);
ifd.putIFDValue(IFD.SOFTWARE, "Elphel Eyesis");
ifd.putIFDValue(IFD.IMAGE_DESCRIPTION, description);
// copy some other data?
......@@ -484,7 +486,7 @@ the type of pixel data in this file getPixelType()
true); // boolean last)
}
public void saveTiffARGB32(
public static void saveTiffARGB32(
ImagePlus imp,
String path,
boolean imageJTags,
......@@ -511,18 +513,19 @@ the type of pixel data in this file getPixelType()
bytes[pIndex++]=(byte) ((iPixels[i]>>24)& 0xff); // alpha
}
IFD ifd=new IFD();
ifd.put(new Integer(IFD.LITTLE_ENDIAN), new Boolean(false));
ifd.put(IFD.LITTLE_ENDIAN, false);
// ifd.put(new Integer(IFD.LITTLE_ENDIAN), new Boolean(true));
ifd.put(new Integer(IFD.IMAGE_WIDTH), imp.getWidth());
ifd.put(new Integer(IFD.IMAGE_LENGTH), imp.getHeight());
ifd.put(new Integer(IFD.SAMPLES_PER_PIXEL), 4);
ifd.put(IFD.IMAGE_WIDTH, imp.getWidth());
ifd.put(IFD.IMAGE_LENGTH, imp.getHeight());
ifd.put(IFD.SAMPLES_PER_PIXEL, 4);
ifd.putIFDValue(IFD.SOFTWARE, "Elphel Eyesis");
ifd.putIFDValue(IFD.IMAGE_DESCRIPTION, description);
// copy some other data?
ifd.putIFDValue(IFD.COMPRESSION, 1); //TiffCompression.UNCOMPRESSED);
ifd.putIFDValue(IFD.PHOTOMETRIC_INTERPRETATION,2); // RGB
ifd.putIFDValue(IFD.EXTRA_SAMPLES,2); // extra bytes (over 3) meaning Unassociated alpha data
// ifd.putIFDValue(IFD.EXTRA_SAMPLES,2); // extra bytes (over 3) meaning Unassociated alpha data
ifd.putIFDValue(IFD.EXTRA_SAMPLES,1); // extra bytes (over 3) meaning Unassociated alpha data
ifd.putIFDValue(IFD.SAMPLE_FORMAT,1); //
// int [] bpsArray={8,8,8,8};
// ifd.putIFDValue(IFD.BITS_PER_SAMPLE, bpsArray); // will be done automatically
if (imp.getProperty("XPosition")!=null) {
......@@ -548,24 +551,9 @@ the type of pixel data in this file getPixelType()
int index=0;
for (int i=0;i<ImageJInfoMagic.length;i++) bInfo[index++]=ImageJInfoMagic[i];
for (int i=skipFirstBytes;i<bInfoBody.length; i++) bInfo[index++]=bInfoBody[i]; // first 2 bytes {-2, -1} ???
/*
StringBuffer sb=new StringBuffer("bInfo: ");
for (int i=0;i<bInfo.length;i++) sb.append(bInfo[i]+" ");
System.out.println(sb.toString());
sb=new StringBuffer("ImageJInfoMagic: ");
for (int i=0;i<ImageJInfoMagic.length;i++) sb.append(ImageJInfoMagic[i]+" ");
System.out.println(sb.toString());
sb=new StringBuffer("bInfoBody: ");
for (int i=0;i<bInfoBody.length;i++) sb.append(bInfoBody[i]+" ");
System.out.println(sb.toString());
System.out.println("info[0]="+info.charAt(0));
System.out.println("info[1]="+info.charAt(1));
System.out.println("info[2]="+info.charAt(2));
*/
long [] imageJcounts={12, bInfoBody.length-skipFirstBytes};
ifd.putIFDValue(IFDImageJByteCounts, imageJcounts);
ifd.putIFDValue(IFDImageJInfo, bInfo);
}
(new File(path)).delete(); // Otherwise TiffSaver appends!
TiffSaver tiffSaver = new TiffSaver(path);
......@@ -584,7 +572,7 @@ the type of pixel data in this file getPixelType()
public void propertiesTiff(ImagePlus imp){
public static void propertiesTiff(ImagePlus imp){
FileInfo fi = imp.getOriginalFileInfo();
if ((fi==null) ||(fi.directory==null) || (fi.fileFormat!=FileInfo.TIFF)) {
IJ.error("TIFF Dumper", "File path not available or not TIFF file");
......
......@@ -3070,7 +3070,7 @@ public class TexturedModel {
hdr_whs[0], // int width,
wh, // int [] wh, // should be initialized to int [2]
full_render); // double [][] img_src)
if (img_cropped != null) {
if (img_cropped != null) { // has NaN and alpha 0-1
scenes[ref_index].saveDoubleArrayInModelDirectory(
suffix+"-CROP", // String suffix,
null, // String [] labels, // or null
......
......@@ -131,7 +131,7 @@ public class TileNeibs{
* @param dy offset in y direction
* @return new index or -1 if leaving
*/
int getNeibIndex(int indx, int dx, int dy) {
public int getNeibIndex(int indx, int dx, int dy) {
int y = indx / sizeX + dy;
int x = indx % sizeX + dx;
if ((x < 0) || (y < 0 ) || (x >= sizeX) || (y >= sizeY)) return -1;
......
Markdown is supported
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