Пример #1
0
bool ImageHistogram<T>::_reset(){
	bool success = true;
	if ( m_image != nullptr ){
	    if ( !m_histogramMaker ){
	        m_histogramMaker = new casa::LatticeHistograms<T>( *(m_image) );
	    }
		try {
			if ( m_region == NULL ){
				//Make the histogram based on the image
				_filterByChannels( m_image );
			}
			else {
				//Make the histogram based on the region
				casa::SubImage<T>* subImage = new casa::SubImage<T>( *m_image, *m_region );
				 _filterByChannels( subImage );
				//Filter will make a new image based on this one so we can delete this sub
				//image once filter is done.
				delete subImage;
			}
			success = compute();
		}
		catch( casa::AipsError& error ){
			success = false;
			qDebug() << "Error making histogram: "<<error.getMesg().c_str();
		}
	}
	else {
		success = false;
	}
	return success;
}
Пример #2
0
bool ImageHistogram<T>::_reset() {
    bool success = true;
    if ( m_image != nullptr ) {
        if ( m_histogramMaker != NULL ) {
            //delete m_histogramMaker;
            m_histogramMaker = NULL;
        }
        try {
            if ( m_region == NULL ) {
                //Make the histogram based on the image
                m_histogramMaker = _filterByChannels( m_image );
            }
            else {
                //Make the histogram based on the region
                m_subImage.reset(new casa::SubImage<T>( *m_image, *m_region ));
                if ( m_subImage.get() != NULL ) {
                    m_histogramMaker = _filterByChannels( m_subImage.get() );
                }
                else {
                    success = false;
                }
            }
            if ( success ) {
                success = compute();
            }
        }
        catch( casa::AipsError& error ) {
            success = false;
            /*if ( heightSource != NULL ){
            	QString msg( "Could not make a histogram of the region: ");
            	msg.append( error.getMesg().c_str() );
            	heightSource->postMessage( msg );
            }*/
        }
    }
    else {
        success = false;
    }
    return success;
}