[ome-devel] ScanR Reader

Rubén Muñoz ruben.munoz at embl.de
Fri May 14 13:23:52 BST 2010


Hi Melissa, 

I am glad to hear from you and hope that the successful changes are of use to your purpose. 
I have identified my current sets slightly different to the examples provided before that's why I will upload one more. 

Regarding your latest changes in ScanrReader.java: 

> 
>> 1)   Setting nPos = realPosCount and after you core = new CoreMetadata[nWells * nPos];
>> you're getting too many positions in the core array.
> 
> This is certainly the case if realPosCount is greater than the
> original value of nPos.  The approach taken in r6313 is to set nPos to
> the lesser of nPos and realPosCount; does that work for your test
> cases?

Only recently I started getting multiple positions in a well, and I have just tried with old and new datasets. Your guess is correct and now this works again.


>> 3) In newer acquisitions "timeloop real" was replaced by "timeloop count" and it is 0 for only
>> 1 timepoint acquisitions, so I had to add one (+ 1) to the parsed value.
> 
> My concern is that the value of "timeloop count" appears to be
> unreliable.  I have a few datasets that are as you describe -
> "timeloop count" is equal to the number of timepoints minus 1.

Mmm. I think that some users configure the microscope to 99 loops and then interrupt the acquisition, must be a bad practice from their side. In those cases probably the Olympus software "alert us" setting "timeloop real". This is only a guess but again the code works as it was. You are right to leave this modification out but the lower value  of "timeloop real" and "timeloop count +1 " should work also.

As I said, recently I received new datasets... What a surprise when some didn't have labels "A1", "A2", ... Well those are not importing. Please permit me again to show my small corrections that did the trick:

My best regards,

--- ScanrReader.java	(revision 6315)
+++ ScanrReader.java	(working copy)
@@ -70,6 +70,7 @@
   private Vector<String> metadataFiles = new Vector<String>();
   private int wellRows, wellColumns;
   private int fieldRows, fieldColumns;
+  private int wellCount = 0;
   private Vector<String> channelNames = new Vector<String>();
   private Hashtable<String, Integer> wellLabels =
     new Hashtable<String, Integer>();
@@ -260,13 +261,13 @@
     wellColumns = uniqueColumns.size();
 
     if (wellRows * wellColumns == 0) {
-      if (wellLabels.size() <= 96) {
+      if (wellCount <= 96) {
         wellColumns = 12;
       }
-      else if (wellLabels.size() <= 384) {
+      else if (wellCount <= 384) {
         wellColumns = 24;
       }
-      wellRows = wellLabels.size() / wellColumns;
+      wellRows = wellCount / wellColumns;
       if (wellRows * wellColumns < wellLabels.size()) wellRows++;
     }
 
@@ -298,7 +299,8 @@
     String[] keys = wellLabels.keySet().toArray(new String[wellLabels.size()]);
     int realPosCount = 0;
     for (int well=0; well<nWells; well++) {
-      Integer w = wellLabels.get(keys[well]);
+      Integer w = keys.length > 0 ? wellLabels.get(keys[well]) : null;
+      
       int wellIndex = w == null ? well + 1 : w.intValue();
 
       String wellPos = getBlock(wellIndex, "W");
@@ -334,7 +336,7 @@
       }
     }
 
-    if (wellLabels.size() != nWells) {
+    if (wellLabels.size() > 0 && wellLabels.size() != nWells) {
       uniqueRows.clear();
       uniqueColumns.clear();
       for (String well : wellLabels.keySet()) {
@@ -501,6 +503,7 @@
         else if (key.equals("well selection table + cDNA")) {
           if (Character.isDigit(value.charAt(0))) {
             wellIndex = value;
+	    wellCount++;
           }
           else {
             wellLabels.put(value, new Integer(wellIndex));



> Regards,
> -Melissa
> 
> On Wed, May 5, 2010 at 9:59 AM, Rubén Muñoz <ruben.munoz at embl.de> wrote:
>> Dear Melissa,
>> 
>> Bioformats has incorporated many changes lately, it works for me when I compile loci_tools.jar directly from the SVN. As of yesterday the pre-compiled .jar from your page didn't open the ScanR datasets, please let me know if I can give more details on this.
>> 
>> The reason of my e-mail are some code improvements in ScanrReader.java,
>> 
>> 1)   Setting nPos = realPosCount and after you core = new CoreMetadata[nWells * nPos]; you're getting too many positions in the core array.
>> 
>> 2) row + col gives a concatenation of strings but for small layouts (some people uses small 8-well plates) this results 651?. I introduced here the Well number (different to the Spot number), you may want  to change this but just the Well number is of help here.
>> 
>> 3) In newer acquisitions "timeloop real" was replaced by "timeloop count" and it is 0 for only 1 timepoint acquisitions, so I had to add one (+ 1) to the parsed value.
>> 
>> Please let me know any comment regarding the previous changes, they all might be of help.
>> 
>> Thanks and regards,
>> 
>> Rubén
>> 
>> 
>> 
>> Index: ScanrReader.java
>> ===================================================================
>> --- ScanrReader.java    (revision 6224)
>> +++ ScanrReader.java    (working copy)
>> @@ -347,7 +347,7 @@
>>       wellColumns = uniqueColumns.size();
>>       nWells = wellRows * wellColumns;
>>     }
>> -    nPos = realPosCount;
>> +    //nPos = realPosCount;
>> 
>>     reader = new MinimalTiffReader();
>>     reader.setId(tiffs[0]);
>> @@ -420,11 +420,14 @@
>>       store.setWellSampleImageRef(imageID, 0, well, field);
>>       store.setImageID(imageID, i);
>> 
>> -      String row =
>> -        String.valueOf(wellRows > 26 ? wellRow + 1 : (char) ('A' + wellRow));
>> -      String col =
>> -        String.valueOf(wellRows > 26 ? (char) ('A' + wellCol) : wellCol + 1);
>> -      String name = "Well " + row + col + ", Field " + (field + 1) +
>> +      //String row =
>> +      //  String.valueOf(wellRows > 26 ? wellRow + 1 : (char) ('A' + wellRow));
>> +      //String col =
>> +      //  String.valueOf(wellRows > 26 ? (char) ('A' + wellCol) : wellCol + 1);
>> +
>> +      int wellIndex = wellRow*wellColumns + wellCol + 1;
>> +
>> +      String name = "Well " + wellIndex + ", Field " + (field + 1) +
>>         " (Spot " + (i + 1) + ")";
>>       store.setImageName(name, i);
>>     }
>> @@ -479,8 +482,8 @@
>>         else if (key.equals("# slices")) {
>>           core[0].sizeZ = Integer.parseInt(value);
>>         }
>> -        else if (key.equals("timeloop real")) {
>> -          core[0].sizeT = Integer.parseInt(value);
>> +        else if (key.equals("timeloop count") || key.equals("timeloop real")) {
>> +          core[0].sizeT = Integer.parseInt(value) + 1;
>>         }
>>         else if (key.equals("name")) {
>>           channelNames.add(value);
>> 
>> 
>> 
>> 
>> 
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20100514/99db088c/attachment.html>


More information about the ome-devel mailing list