<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks a lot Melissa, Mark, Curtis,<div><br></div><div>I am having initial success getting all the metadata from the files, so it should hopefully work from now on. That's awesome. </div><div><br></div><div>Adding the dependency that Mark suggested to the pom.xml did the job of being able to import the CZI reader:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'Source Code Pro'; color: rgb(78, 145, 146); "><span style="color: #000000"> </span><span style="color: #009193"><</span>dependency<span style="color: #009193">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'Source Code Pro'; "> <span style="color: #009193"><</span><span style="color: #4e9192">groupId</span><span style="color: #009193">></span><span style="text-decoration: underline">ome</span><span style="color: #009193"></</span><span style="color: #4e9192">groupId</span><span style="color: #009193">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'Source Code Pro'; "> <span style="color: #009193"><</span><span style="color: #4e9192">artifactId</span><span style="color: #009193">></span>formats-<span style="text-decoration: underline">gpl</span><span style="color: #009193"></</span><span style="color: #4e9192">artifactId</span><span style="color: #009193">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'Source Code Pro'; "> <span style="color: #009193"><</span><span style="color: #4e9192">version</span><span style="color: #009193">></span>${<span style="text-decoration: underline">bio</span>-formats.version}<span style="color: #009193"></</span><span style="color: #4e9192">version</span><span style="color: #009193">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'Source Code Pro'; color: rgb(78, 145, 146); "><span style="color: #000000"> </span><span style="color: #009193"></</span>dependency<span style="color: #009193">></span></div></div><div><br></div><div>I will let you know if I succeed. I will need a bigger computer than my laptop to actually run tests, these datasets are gigantic.</div><div><br></div><div>Thanks so much again guys!</div><div><br></div><div>Cheers,</div><div>Steffi</div><div><br><div><div>On May 13, 2014, at 14:06 , Melissa Linkert wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Steffi,<br><br><blockquote type="cite">I have some problems actually being able to implement it. I cannot import the ZeissCZIReader, do I need some new jar or version maybe? (I work on this branch directly <a href="https://github.com/fiji/spimreconstruction/tree/newspimreconstruction">https://github.com/fiji/spimreconstruction/tree/newspimreconstruction</a>, using this pom.xml <a href="https://github.com/fiji/spimreconstruction/blob/newspimreconstruction/pom.xml">https://github.com/fiji/spimreconstruction/blob/newspimreconstruction/pom.xml</a>). <br></blockquote><br>Probably you would need to add a dependency on the artifact that<br>contains Bio-Formats readers:<br><br><dependency><br> <groupId>ome</groupId><br> <artifactId>formats-gpl</artifactId><br> <version>5.0.2-SNAPSHOT</version><br></dependency><br><br><blockquote type="cite">Here is how I started, it is based on what Curtis implemented for me quite some time back and which is still the code I for example use to open standard LSMs using Bioformats:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">// should I use the ZeissCZIReader here directly?<br></blockquote><blockquote type="cite">final IFormatReader r = new ChannelSeparator();<br></blockquote><br>It is not necessary to use a ZeissCZIReader explicitly; file type<br>detection is automatic.<br><br><blockquote type="cite">// is that still necessary (code is below)?<br></blockquote><blockquote type="cite">if ( !createOMEXMLMetadata( r ) )<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>try { r.close(); } catch (IOException e) { e.printStackTrace(); }<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>return null;<br></blockquote><blockquote type="cite">}<br></blockquote><br>Yes, you will need this to be able to query the calibration later on.<br><br><blockquote type="cite">try<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>r.setId( firstFile.getAbsolutePath() );<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>// now I should be able to query all the details, right? But how do I get illuminations and angles?<br></blockquote><br>Each angle is stored in a separate series, so iterating:<br><br>// --<br> for (int angle=0; angle<r.getSeriesCount(); angle++) {<br> r.setSeries(angle);<br> int angleWidth = r.getSizeX();<br> int angleHeight = r.getSizeY();<br> // ... and so on<br> }<br>// --<br><br>should work. Illuminations are contained within the channel count; to<br>find the number of illuminations for the current angle:<br><br>// --<br> // Modulo is in the loci.formats package<br> Modulo moduloC = r.getModuloC();<br> int illuminations = moduloC.length();<br>// --<br><br>Everything else that you have there should work as before, just keep in<br>mind that most of the getters on 'r' affect the current angle only.<br><br>Do note as well that there have been a number of ongoing issues with .czi files,<br>proposed fixes for which are here:<br><br><a href="https://github.com/openmicroscopy/bioformats/pull/1078">https://github.com/openmicroscopy/bioformats/pull/1078</a><br><br>That has not been deployed to OME's Artifactory, though, so just be<br>aware that you may see some exceptions or incorrect behavior until that pull<br>request is merged. The upcoming 5.0.2 release of Bio-Formats will<br>contain those changes as well.<br><br>Regards,<br>-Melissa<br><br>On Tue, May 13, 2014 at 01:11:09PM -0400, Stephan Preibisch wrote:<br><blockquote type="cite">Hi Mark,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">that sounds great, I will give it a shot. I was just not really sure where to start. It seems everything is already in place, that is fantastic. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I have some problems actually being able to implement it. I cannot import the ZeissCZIReader, do I need some new jar or version maybe? (I work on this branch directly https://github.com/fiji/spimreconstruction/tree/newspimreconstruction, using this pom.xml https://github.com/fiji/spimreconstruction/blob/newspimreconstruction/pom.xml). <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Here is how I started, it is based on what Curtis implemented for me quite some time back and which is still the code I for example use to open standard LSMs using Bioformats:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">// should I use the ZeissCZIReader here directly?<br></blockquote><blockquote type="cite">final IFormatReader r = new ChannelSeparator();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">// is that still necessary (code is below)?<br></blockquote><blockquote type="cite">if ( !createOMEXMLMetadata( r ) )<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>try { r.close(); } catch (IOException e) { e.printStackTrace(); }<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>return null;<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">try<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>r.setId( firstFile.getAbsolutePath() );<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>// now I should be able to query all the details, right? But how do I get illuminations and angles?<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final boolean isLittleEndian = r.isLittleEndian();<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final int width = r.getSizeX();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final int height = r.getSizeY();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final int depth = r.getSizeZ();<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>int timepoints = r.getSizeT();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>int channels = r.getSizeC();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final int pixelType = r.getPixelType();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final int bytesPerPixel = FormatTools.getBytesPerPixel( pixelType ); <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final String pixelTypeString = FormatTools.getPixelTypeString( pixelType );<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final MetadataRetrieve retrieve = (MetadataRetrieve)r.getMetadataStore();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>float cal = retrieve.getPixelsPhysicalSizeX( 0 ).getValue().floatValue();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>if ( cal == 0 )<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>cal = 1;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>IOFunctions.println( "StackListLOCI: Warning, calibration for dimension X seems corrupted, setting to 1." );<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>final double calX = cal;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>// and later on open the requested data<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">} catch ( Exception e ) { e.printStackTrace(); }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">public static boolean createOMEXMLMetadata( final IFormatReader r )<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>try <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>final ServiceFactory serviceFactory = new ServiceFactory();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>final OMEXMLService service = serviceFactory.getInstance( OMEXMLService.class );<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>final IMetadata omexmlMeta = service.createOMEXMLMetadata();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>r.setMetadataStore(omexmlMeta);<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>catch (final ServiceException e)<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>e.printStackTrace();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>return false;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>catch (final DependencyException e)<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>e.printStackTrace();<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>return false;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>return true;<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thank you so much for your fast reply!!!<br></blockquote><blockquote type="cite">Steffi<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On May 13, 2014, at 12:25 , Mark Hiner wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Steffi,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a) Read all the metadata<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many timepoints<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many channels<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many angles<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many illumination directions<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - calibration x,y,z (um/px)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> Looking at the latest Bio-Formats CZI reader, it looks like there is support for this metadata already. Looking at the calculateDimensions method you can see that the illuminations, phases, rotations, etc... are all recorded, and if I understand correctly (Melissa can clarify if needed here) they are compressed to ZCT dimensions here.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> Given that Bio-Formats already supports these fields, can you clarify a bit what functionality is missing that you'd like to see? It seems to me like you don't need to implement a completely new reader, but could just use the existing API.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">b) Be able to read individual 3d-stacks: Image = get( Timepoint t, Angle a, Illumination i, Channel c )<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">If I am understanding correctly, what you really want to do is understand how these parameters are being converted to ZCT dimensions and thus plane ranges, and then use openBytes on the correct plane numbers using the Bio-Formats ImageReader API. <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Looking at calculateDimensions again, it looks like the metadata is stored under the plane elements in the XML, I believe. So to do what you'd want, you could write a little plugin that:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">1) Calls setId using Bio-Formats<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">2) Checks the XML planes for the angle, illumination, etc.. parameters you're interested in. If they're not there, return as unsupported data.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">3) Prompts for an input based on the ranges of these parameters<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">4) Converts the received input to image/plane numbers for Bio-Formats<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">5) Calls openBytes as necessary to build the requested 3D image.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I'm envisioning it as an ImageJ plugin but you could adapt as needed.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Does that make sense..? I don't think anything needs to change in the CZI Reader, or additional reader layers on top..<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Again, Melissa please correct me if I got anything wrong.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Steffi, let me know if you'd like clarification on anything, or if I misunderstood what you're trying to do.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Mark<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">On Tue, May 13, 2014 at 10:25 AM, Stephan Preibisch <preibischs@janelia.hhmi.org> wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Hi Melissa, Mark, Curtis,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">if you have a second, I would have a question about Bioformats, Scifio and LOCI. The guys at Zeiss told me that you recently added support for the multi-view, multi-channel, multi-timepoint CZI files as they are saved by their Lightsheet Z.1 microscope. Is that correct?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">If so, I want to implement a specialized reader for those files. What I want to achieve is the following:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a) Read all the metadata<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many timepoints<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many channels<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many angles<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - how many illumination directions<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> - calibration x,y,z (um/px)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">b) Be able to read individual 3d-stacks: Image = get( Timepoint t, Angle a, Illumination i, Channel c )<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">This data can be in one gigantic file or distributed over many different files. So I am not sure how to start. Do you abstract that already, or should I do that?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Should I use Scifio? And if so, where should I start reading, and which version do I need? Is that compatible with the current version that is in Fiji?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thank you so much for your help!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cheers,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Steffi<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br></div></body></html>