This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

ImageJ - how to get number of z-slices / image dimensions ???

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there, I'd just like to say first of all how happy I was to find this site!

I am working on a macro to run with ImageJ for processing 4-dimensional images.
It should open the image sequence, average the z-slices for each timepoint, and then perform other processing functions on the series. Everything works, except I cannot manage to extract information on the number of z-slices in the series.
I tried getDimensions() and getHeight() etc and they all misread the stack.

So I figure I have two alternatives:
one, I could find a way to access the handy little text file that is included in the directory with each image sequence... but this I do not know how to access!
Or, I could extract the information on the z-slices from the image names, because they are named in the following way:
name_timepoint0000_z0000.tif

Using lastIndexOf and substring commands I was able to assign the zed number to a variable. But it is of course a string, and I do not know of a way to convert it to an integer type in ImageJ Java. I need to input the number of zeds into the Run grouped z-projector command.

I hope there is some kind soul out there who will save me from any more fruitless hours of scouring the web for a hint as to how to do this...
Thanks in advance
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

I've moved this to the Open Source forum for you, hopefully there's an ImageJ user out there to help!
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the file format you are opening? If it is one of the big formats (MetaMorph .nd, LSM, etc...) then chances are LOCI's BioFormats can help you open the data and read the form dimensional info. See the LOCI for ImageJ site for info, including a link to an example for getting all the Meta Data out.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!