Greetings Kenneth,

The TIFF file format can save more than just the pixel data. The pasted
code below is what I stole from ImageJ code that saves TIFF files, so it
should be the same as stock.  The two points of interest for you is
FileInfo and properties. FileInfo I believe contains the calibration that
you are interested in. If not, the properties, see
ImagePlus.setProperties, can be used to store the information that you can
use to reconfig the imported TIFF files to your liking.

For the calibration info separate from the TIFF files, google 'java
properties saving to file'.

Enjoy,

Fred


   public static boolean saveTiff(OutputStream os, ImagePlus imp) throws
IOException {
      FileInfo fi = imp.getFileInfo();
      fi.description = (new FileSaver(imp)).getDescriptionString();
      fi.info = imp.getInfoProperty();
      fi.properties = imp.getPropertiesAsArray();
      if (imp.getProperty(Plot.PROPERTY_KEY) != null) {
         Plot plot = (Plot)(imp.getProperty(Plot.PROPERTY_KEY));
         fi.plot = plot.toByteArray();
         }
      fi.roi = RoiEncoder.saveAsByteArray(imp.getRoi());
      fi.overlay = FileSaver.getOverlay(imp);
      fi.sliceLabels = imp.getStack().getSliceLabels();
      if (imp.isComposite()) (new
FileSaver(imp)).saveDisplayRangesAndLuts(imp, fi);
      if (fi.nImages>1 && imp.getStack().isVirtual())
         fi.virtualStack = (VirtualStack)imp.getStack();

      TiffEncoder te = new TiffEncoder(fi);
      te.write(os);
      return true;
      }


On Fri, June 21, 2024 6:37 am, Kenneth R Sloan wrote:
> I have about 200 .tif images in about 5 directories. They are identical in
> scale, and all contain a scale bar in a fixed position and known length.
>
> I would like to attach a Calibration to every image, based on a user
> selecting the two ends of the scale bar in one image, and then propagating
> that Calibration to the same ther images.
>
> My plan is one Java plugin (I’m most comfortable with these) to
> establish
> the Calibration and save it (how?  What format?) and then another to allow
> the user to specify the saved scale information and a directory contained
> Ning many images.  This second plugin would simply attach the Calibration
> to every image in the directory and overwrite the images.
>
> Any hints?
>
> For now I think I just want mm/pixel, but it might be nice to generalize
> to
> all parameters of a Calubration.
>
> -Kenneth Sloan
>
>
> On Fri, Jun 21, 2024 at 05:27 CARL Philippe (LBP)
> <[email protected]>
> wrote:
>
>> Dear all,
>> With the macro instruction RoiManager.selectGroup(group) I can select a
>> bunch of ROIs which have previously be set as being part of a given
>> group.
>> How can I then get the indexes of the selected ROIs ?
>> RoiManager.selected gives me only the number of selected ROIs.
>> As roiManager("index") gives me only "the index of the first selected
>> ROI
>> if more than one is selected".
>> Thus it seems that a macro instruction like roiManager("indexes") is
>> missing.
>> Or is there an alternative method that I may be missing ?
>> Thanks a lot in advance for your help.
>> My best regards,
>> Philippe
>>
>> Philippe CARL
>> Laboratoire de Bioimagerie et Pathologies
>> UMR 7021 CNRS - Université de Strasbourg
>> Faculté de Pharmacie
>> 74 route du Rhin
>> <https://www.google.com/maps/search/74+route+du+Rhin?entry=gmail&source=g>
>> 67401 ILLKIRCH
>> Tel : +33(0)3 68 85 41 41
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to