Commits

Anonymous committed 628a04e

trying cdf plot on histogram

Comments (0)

Files changed (3)

Code/Common/Gui/mvdHistogramController.cxx

     double* x = new double[ size ];
     double* y = new double[ size ];
 
+
     double xMin = std::numeric_limits< double >::quiet_NaN();
     double yMin = std::numeric_limits< double >::quiet_NaN();
     double xMax = std::numeric_limits< double >::quiet_NaN();
 
     model->GetData( band, x, y, xMin, xMax, yMin, yMax );
 
-    widget->SetData( chan, x, y, size, xMin, yMin, xMax, yMax );
+    size_t cdfsize = 100;
+    std::cerr << cdfsize << ":size\n";
+    double* cdfx = new double[ cdfsize ];
+    double* cdfy = new double[ cdfsize ];
+    cdfx[0] = 0;
+
+    for(int ww  = 1; ww < cdfsize; ww++)
+    {
+      cdfx[ww] = y[ww];
+      cdfy[ww] = cdf[ww-1] + y[ww];
+    }
+
+    widget->SetData( chan, x, y,cdfx,cdfy, size, xMin, yMin, xMax, yMax, cdfsize);
 
     widget->SetLowMarker( chan, settings.GetLowIntensity( chan ) );
     widget->SetHighMarker( chan, settings.GetHighIntensity( chan ) );

Code/Common/Gui/mvdHistogramWidget.cxx

   //
   // CURVES.
 
+    m_CdfCurves = new QwtPlotCurve( tr( "CDF" ) );
+    m_CdfCurves->setStyle( QwtPlotCurve::Lines );
+
+    m_CdfCurves->setPen( QPen( CURVE_COLORS[ 0 ] ) );
+    //m_CdfCurves->setBrush( QBrush( CURVE_COLORS[ 0 ] ) );
+
+
+m_CdfCurves->attach( m_UI->histogramPlot );
+
+
   HistogramPlotPicker::PlotCurveVector curves( HistogramWidget::CURVE_COUNT );
 
   for( CountType i=0; i<HistogramWidget::CURVE_COUNT; ++i )
 void
 HistogramWidget
 ::SetData( RgbwChannel channel,
-	   double * const x, double * const y, size_t size,
+	   double * const x, double * const y, double *cdf, size_t size,
 	   double xMin, double yMin,
-	   double xMax, double yMax )
+	   double xMax, double yMax, size_t cdfsize )
 {
   assert( ( x==NULL && y==NULL && size==0 ) ||
 	  ( x!=NULL && y!=NULL && size!=0 ) );
     assert( m_PlotCurves[ i ]!=NULL );
 
     m_PlotCurves[ i ]->setData( x, y, size );
+    m_CdfCurves->setData( x, cdf, cdfsize );
 
     if( x==NULL && y==NULL )
       m_PlotCurves[ i ]->setVisible( false );
 	  : i==index ); 
 
     m_PlotCurves[ i ]->setVisible( isVisible );
+ m_CdfCurves->setVisible( true );
     m_LowPlotMarkers[ i ]->setVisible( isVisible );
     m_HighPlotMarkers[ i ]->setVisible( isVisible );
     }

Code/Common/Gui/mvdHistogramWidget.h

    */
   void SetData( RgbwChannel channel,
 		double * const x,
-		double * const y,
+		double * const y,double * const cdf,
 		size_t size,
 		double xMin, double yMin,
-		double xMax, double yMax );
+		double xMax, double yMax, size_t cdfsize );
+
+
 
   /**
    */
    */
   QwtPlotCurve* m_PlotCurves[ CURVE_COUNT ];
 
+  QwtPlotCurve* m_CdfCurves;
   /**
    */
   QwtPlotMarker* m_LowPlotMarkers[ CURVE_COUNT ];