ListDemo


SUBMITTED BY: smart4two

DATE: Jan. 1, 2018, 12:20 p.m.

FORMAT: Text only

SIZE: 860 Bytes

HITS: 147

  1. // List Demo
  2. //
  3. // This macro demonstrates how to use the List.*
  4. // functions added in ImageJ 1.41f.
  5. requires("1.41f");
  6. print("Adding key/value pairs to list");
  7. List.set("key1", "value1");
  8. List.set("key2", "value2");
  9. List.set("key3", "value3");
  10. print("Size of list: "+ List.size);
  11. print("Retrieving values");
  12. List.get("key1");
  13. List.get("key2");
  14. List.get("key3");
  15. print("Opening 'blobs' sample image");
  16. run("Blobs (25K)");
  17. print("Saving list as 'Info' image propery");
  18. list = List.getList();
  19. setMetadata("info", list);
  20. path = getDirectory("temp")+"test.tif"
  21. print("Saving image as TIFF");
  22. save(path);
  23. close();
  24. print("Reseting list");
  25. List.clear;
  26. print("Reopening image and recovering list");
  27. open(path);
  28. info = getMetadata("info");
  29. List.setList(info);
  30. List.getList;
  31. close();

comments powered by Disqus