Package org.mcisb.beacon.spottedexperiment

Examples of org.mcisb.beacon.spottedexperiment.MicroscopeRecording


            // 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();         
                      }
View Full Code Here

TOP

Related Classes of org.mcisb.beacon.spottedexperiment.MicroscopeRecording

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.