Package pedro.view

Examples of pedro.view.NavigationTreeNode


      {
        final List resultNodes = new NodeUtils().getChildNodes( spotNode, "RESULT" ); //$NON-NLS-1$
     
      for( Iterator iterator = resultNodes.iterator(); iterator.hasNext(); )
      {
        NavigationTreeNode resultNode = (NavigationTreeNode)iterator.next();
        os = new FileOutputStream( new File( directory, new FileUtils().convertCharacters( resultNode.getDisplayName() ) + ".xls" ) ); //$NON-NLS-1$
        generateData( resultNode ).write( os );
        os.close();
      }
      }
      finally
View Full Code Here


     */
    private void generateHeader( NavigationTreeNode resultNode, HSSFSheet sheet )
    {
    // Just get the second state as this will give us all the details for the header
    // Note: the first state can often be empty at time 0.0!
    NavigationTreeNode stateNode = null;
   
    for( Enumeration resultChildren = resultNode.children(); resultChildren.hasMoreElements(); )
    {
      final NavigationTreeNode timeSeriesNode = (NavigationTreeNode)resultChildren.nextElement();     
       
        if( timeSeriesNode.getDisplayName().trim().startsWith("RESULTTIMESERIES" ) ) //$NON-NLS-1$
        {
          int index = 0;   
         
        for( Enumeration timeSeriesChildren = timeSeriesNode.children(); timeSeriesChildren.hasMoreElements(); )
        {       
            stateNode = (NavigationTreeNode)timeSeriesChildren.nextElement();       
   
            if( stateNode.getDisplayName().trim().startsWith( "RESULTSTATE" ) ) //$NON-NLS-1$
            {     
            if( index == 1 )
            {
              break;
            }
           
            index++;
            }
        }
   
        // Got an exemplar state now, so break out
        break;       
        }
 
    }
 
    if( stateNode != null )
    {
      final List cells = nodeUtils.getChildNodes( stateNode, "CELL" ); //$NON-NLS-1$
      final List cellularCompartments = nodeUtils.getChildNodes( cells, "CELLULARCOMPARTMENT" ); //$NON-NLS-1$
      final List cellProperties = nodeUtils.getChildNodes( cellularCompartments, "CELLPROPERTY" ); //$NON-NLS-1$
      final List channels = nodeUtils.getChildNodes( cellProperties, "CHANNEL" ); //$NON-NLS-1$
 
        /*
         * Format of header should be:
         * |Timestamp|Cell name                       |Cell name                         |
         * |         |Cell Compart 1 | Cell Compart 2 |Cell Compart 1 | Cell Compart 2   |
         * |         |Prop 1 |Prop2  |Prop 1 |Prop2   | ...
         * |         |Ch1|Ch2|...
         */
 
        // Create the header row
        // Create the timestamp row in all 4 header lines
      final HSSFRow cellHeaderRow = sheet.createRow( (short)0 );
      final HSSFRow cellCompartmentsHeaderRow = sheet.createRow( (short)1 );
      final HSSFRow cellPropertiesHeaderRow = sheet.createRow( (short)2 );
      final HSSFRow cellChannelsHeaderRow = sheet.createRow( (short)3 );     
       
        cellHeaderRow.createCell( (short)0 ).setCellValue(new HSSFRichTextString("Timestamp") ); //$NON-NLS-1$
        cellCompartmentsHeaderRow.createCell( (short)0 ).setCellValue(new HSSFRichTextString("(Secs)")); //$NON-NLS-1$
        cellPropertiesHeaderRow.createCell( (short)0 );
        cellChannelsHeaderRow.createCell( (short)0 );
       
        final int cellSpan = channels.size() * cellProperties.size() * cellularCompartments.size();
       
        for( int i = 0; i < cells.size(); i++ )
        {
        // Add cell name to its row
          final NavigationTreeNode cellNode = (NavigationTreeNode)cells.get( i );
          final String cellName = cellNode.getDisplayName().trim();
   
          final int startOfCellRegion = ( i * cellSpan ) + 1; // +1 to account for the timestamp row
        cellHeaderRow.createCell( (short)startOfCellRegion ).setCellValue(new HSSFRichTextString(cellName));
   
        final int cellularCompartmentSpan = channels.size() * cellProperties.size();
       
        for( int j = 0; j < cellularCompartments.size(); j++ )
        {
            // Cell compartment name to its row
          final NavigationTreeNode cellularCompartmentNode = (NavigationTreeNode) cellularCompartments.get( j );
          final String cellularCompartmentName = cellularCompartmentNode.getDisplayName().trim();
   
          final int startOfCellCompartmentRegion = ( j * cellularCompartmentSpan ) + startOfCellRegion;
            cellCompartmentsHeaderRow.createCell( (short)startOfCellCompartmentRegion ).setCellValue(new HSSFRichTextString(cellularCompartmentName));
   
            final int cellPropertiesSpan = channels.size();
           
            for( int k = 0; k < cellProperties.size(); k++ )
            {
            // Cell Property name to its row
              final NavigationTreeNode cellPropNode = (NavigationTreeNode)cellProperties.get( k );
              final String cellPropName = cellPropNode.getDisplayName().trim();
           
              final int startOfCellPropRegion = ( k * cellPropertiesSpan ) + startOfCellCompartmentRegion;
            cellPropertiesHeaderRow.createCell( (short)startOfCellPropRegion ).setCellValue(new HSSFRichTextString(cellPropName));
     
            final int cellChannelsSpan = 1;
           
            for( int l = 0; l < channels.size(); l++ )
            {
                // Cell channel name to its row
              final NavigationTreeNode channelNode = (NavigationTreeNode)channels.get( l );
              final String channelName = channelNode.getDisplayName().trim();
              final int startOfChannelRegion = ( l * cellChannelsSpan ) + startOfCellPropRegion;
                cellChannelsHeaderRow.createCell( (short)startOfChannelRegion ).setCellValue(new HSSFRichTextString(channelName));
            }
            }
        }
View Full Code Here

    {
    final Enumeration resultChildren = resultNode.children();
   
    while( resultChildren.hasMoreElements() )
    {
        final NavigationTreeNode timeSeriesNode = (NavigationTreeNode)resultChildren.nextElement();
       
        if( timeSeriesNode.getDisplayName().trim().startsWith( "RESULTTIMESERIES" ) ) //$NON-NLS-1$
        {
          int currentRowNumber = 4;
          final Enumeration timeSeriesChildren = timeSeriesNode.children()
                 
          while( timeSeriesChildren.hasMoreElements() )
          {       
            final NavigationTreeNode stateNode = (NavigationTreeNode)timeSeriesChildren.nextElement();       
           
            if( stateNode.getDisplayName().trim().startsWith( "RESULTSTATE" ) ) //$NON-NLS-1$
            {     
              final List cells = nodeUtils.getChildNodes( stateNode, "CELL" ); //$NON-NLS-1$
              final List cellularCompartments = nodeUtils.getChildNodes( cells, "CELLULARCOMPARTMENT" ); //$NON-NLS-1$
              final List cellProperties = nodeUtils.getChildNodes( cellularCompartments, "CELLPROPERTY" ); //$NON-NLS-1$
              final List channels = nodeUtils.getChildNodes( cellProperties, "CHANNEL" ); //$NON-NLS-1$
                     
              final HSSFRow currentDataRow = sheet.createRow( (short)currentRowNumber );     
                     
              final double timestamp = nodeUtils.getDoubleFieldValue( stateNode, "TimeStamp" ); //$NON-NLS-1$
              currentDataRow.createCell( (short)0).setCellValue( timestamp );
               
              for( int i = 0; i < channels.size(); i++ )
              {
                NavigationTreeNode channelNode = (NavigationTreeNode)channels.get( i );
                double value = nodeUtils.getDoubleFieldValue( channelNode, "channel_intensity" ); //$NON-NLS-1$
                currentDataRow.createCell( (short)( i + 1 ) ).setCellValue( value );
              }
            }
            currentRowNumber++;
View Full Code Here

 
        final List dishes = nodeUtils.getChildNodes( nodeUtils.getChildNodes( node, "ASSAY" ), "DISH" ); //$NON-NLS-1$ //$NON-NLS-2$
       
        for( Iterator iterator = dishes.iterator(); iterator.hasNext(); )
        {
        final NavigationTreeNode dishNode = (NavigationTreeNode)iterator.next();
        final File dishDir = fileUtils.mkdir( experimentDir, fileUtils.convertCharacters( dishNode.getDisplayName() ) );     
       
        final List spots = nodeUtils.getChildNodes( dishNode, "SPOTREADING" ); //$NON-NLS-1$
       
        for( Iterator spotIterator = spots.iterator(); spotIterator.hasNext(); )
        {
            final NavigationTreeNode spotNode = (NavigationTreeNode)spotIterator.next();
            final File spotDir = fileUtils.mkdir( dishDir, fileUtils.convertCharacters( spotNode.getDisplayName() ) );
            exportSpot( spotDir, spotNode, writeLSM, writeExcel );
          }
      }
    }
    finally
View Full Code Here

      //Get the GAL file and populate part of the model
     
      SpotterImporter spotterImporter = new SpotterImporter(recordModelFactory, navigationTree, node1);
     
      if (spotterImporter.process()) {
        final NavigationTreeNode node = spotterImporter.getNode();
        // Get the Zeiss MDB file:
        final File file = new FileChooserUtils().getFile( "mdb" ); //$NON-NLS-1$

        if( file != null )
        {
          try
          {
            final List recordings = new ArrayList();
            new ExperimentFactory().getInstance( file, recordings );        

            // This is a bit tricky as this branch of the tree has already been partially
            // populated by the GAL file loader

            // Put the raw MDB file as a child of the current node.
            // First get a complete copy of the current node
            final RecordModel array = node.getRecordModel();
            array.setValue( "equipment_file_name", file.getAbsolutePath(), false ); //$NON-NLS-1$

            // Go through the stored model and find the appropriate recording for each spot node at this scope is an Assay
            final NodeUtils nodeUtils = new NodeUtils();

            // Need the microscope recording object here in order to add a microscope:
          MicroscopeRecording recording =null;
         
          String lensNA =""; //$NON-NLS-1$
          String mag=""; //$NON-NLS-1$
          String lensName=""; //$NON-NLS-1$
            // Need to precompute the total number of spots on each dish and cache this   
            final int numberOfDishes = nodeUtils.getIntegerFieldValue( node, "numberOfDishes" ); //$NON-NLS-1$

            for( int i = 0; i < numberOfDishes; i++ )
            {
              final String dishDisplayName = "DISH:-" + ( i + 1 ); //$NON-NLS-1$

              RecordModel microscopeRecordModel = recordModelFactory.createRecordModel( "Microscope" ); //$NON-NLS-1$
              for( Enumeration assayChildren = node.children(); assayChildren.hasMoreElements(); )
              {
                NavigationTreeNode dishNode = (NavigationTreeNode)assayChildren.nextElement();

                if( dishNode.getDisplayName().trim().equals( dishDisplayName ) )
                {     
                  // should have got the appropriate dish by here
                  // Get number of rows/columns from this dish, as each dish could be different :-(
                  final int rows = nodeUtils.getIntegerFieldValue( dishNode, "numberOfRows" ); //$NON-NLS-1$
                  final int columns = nodeUtils.getIntegerFieldValue( dishNode, "numberOfColumns" ); //$NON-NLS-1$

                  final List selectedSpots = new ArrayList();
                  final Collection deselectedSpots = new ArrayList();

                  for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
                  {
                    final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();
                    final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
                    final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$

                    final Collection plasmids = new ArrayList();
                    final Spot spot = new Spot( new SpotReading( plasmids, plasmids ) );
                    spot.setRow( rowNumber );
                    spot.setColumn( columnNumber );

                    selectedSpots.add( spot );
                  }

                  // Ask the user about which spots they asked the microscope to track
                  getTrackedSpots( rows, columns, recordings.size(), selectedSpots, deselectedSpots );

                  final boolean deleteNonTrackedSpots = ( deselectedSpots.size() > 0 ) ? deleteNonTrackedSpots() : false;

                  for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
                  {
                    final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();

                    if( spotNode.getDisplayName().trim().startsWith( "SPOTREADING" ) ) //$NON-NLS-1$
                    {
                      final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
                      final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$

                      // Now get the appropriate Microscope model and add it to this spot:
                      recording = getRecording( recordings, selectedSpots, rowNumber, columnNumber );
                      final RecordModel spotRecordModel = spotNode.getRecordModel();         

                      if( recording != null )
                      {         
                        //$NON-NLS-1$   

                        lensNA=recording.getLensNA();
                        lensName=recording.getLensName();
                        mag=recording.getMagnification();

                        for( Iterator iterator = recording.getTracks().iterator(); iterator.hasNext(); )
                        {
                          addTrack( (UniqueObject)iterator.next(), recordModelFactory, spotRecordModel );
                        }

                        for( Iterator iterator = recording.getLasers().iterator(); iterator.hasNext(); )
                        {
                          addLaser( (Laser)iterator.next(), recordModelFactory, spotRecordModel );
                        }

                        spotRecordModel.setValue( "acquisition_time", recording.getAquisitionTime(), false ); //$NON-NLS-1$
                        spotRecordModel.updateDisplayName();

                        for( Iterator iterator = spotRecordModel.getFields().iterator(); iterator.hasNext(); )
                        {
                          final DataFieldModel dataFieldModel = (DataFieldModel)iterator.next();

                          if( dataFieldModel.getName().trim().equals( "Microscope" ) ) //$NON-NLS-1$
                          {
                            spotRecordModel.removeField( dataFieldModel )
                          }
                        }

                        // TODO: Work out why Microscope cannot be added.
                        // spotRecordModel.addChild( "Microscope", microscopeRecordModel, false ); //$NON-NLS-1$

                        // Add Results stub to this spot reading
                        final RecordModel resultRecordModel = recordModelFactory.createRecordModel( "Result" ); //$NON-NLS-1$

                        resultRecordModel.setValue( "results_file", recording.getName(), false ); //$NON-NLS-1$
                        resultRecordModel.updateDisplayName();

                        spotRecordModel.addChild( "Result", resultRecordModel, false ); //$NON-NLS-1$
                        spotRecordModel.updateDisplayName();         
                      }
                      else if( deleteNonTrackedSpots )
                      {
                        final NavigationTreeNode parentNode = (NavigationTreeNode)spotNode.getParent();
                        final RecordModel parentRecordModel = parentNode.getRecordModel();

                        for( Iterator iterator = parentRecordModel.getFields().iterator(); iterator.hasNext(); )
                        {
                          final DataFieldModel dataFieldModel = (DataFieldModel)iterator.next();
View Full Code Here

TOP

Related Classes of pedro.view.NavigationTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.