Exemple #1
0
void MainWindow::setupConnections()
{
	int		i;

	/*
		Andrea修改
	*/
	//connect( openButton,		  SIGNAL(clicked()), this, SLOT( launchBMPImport() ) );  測試用 

    connect( openBMP,			 	SIGNAL(clicked()),						this,       			SLOT(launchBMPImport()) );						// 按下open BMP  可以讀取圖檔  Andrea
    connect( openBMP_2,			 	SIGNAL(clicked()),						this,       			SLOT(launchBMPImport()) );						// 按下open BMP  可以讀取圖檔  Andrea    2號用在measure
	connect( progress,				SIGNAL(signalImage(int,QImage)),		this,					SLOT(displayImage(int,QImage)) );				// 輸出畫面到顯示視窗

	connect( filedata,			 	SIGNAL(svgChanged(QString)),			pivDisplay_3,			SLOT(displaySVG(QString)) );					// 丟svg的方式顯示圖片 (svg暫存在硬碟)   丟到視窗三去做顯示

	connect( ScaleW,			 	SIGNAL(valueChanged(int)),				settings,    			SLOT(set_scale_w(int)) );						// 設定 Gauss filter scale w
	connect( ScaleL,			 	SIGNAL(valueChanged(int)),				settings,    			SLOT(set_scale_l(int)) );						// 設定 Gauss filter scale l
	connect( measureX,			 	SIGNAL(valueChanged(int)),				settings,    			SLOT(set_measure_X(int)) );						// 設定 Measure的座標X
	connect( measureY,			 	SIGNAL(valueChanged(int)),				settings,    			SLOT(set_measure_Y(int)) );						// 設定 Measure的座標Y
	connect( this,               	SIGNAL(doprocess()),                	process,				SLOT(processBatch()) );							// 進行process的動作
	connect( DoFilter,			 	SIGNAL(clicked()),						this,					SLOT(blob()) );									// 按下按鈕 開始執行blob detector  (包含subblob  watershed)
	connect( ChannelButton,			SIGNAL(clicked()),						this,					SLOT(channel()) );								// 抽取指定顏色的通道 
	connect( FFTJunctionButton,   	SIGNAL(clicked()),						this,					SLOT(FFTJunctionProcess()) );					// 按下按鈕 開始執行 FFT Junction Detector
	connect( SteerJunctionButton, 	SIGNAL(clicked()),						this,					SLOT(SteerJunctionProcess()) );					// 按下按鈕 開始執行 Steer Junction Detector
	connect( EdgeButton,		  	SIGNAL(clicked()),						this,					SLOT(EdgeProcess()) );							// 按下按鈕 開始執行 Subpixel Edge
	connect( CornerButton,		  	SIGNAL(clicked()),						this,					SLOT(CornerProcess()) );						// 按下Corner的按鈕 進行subpixel的Corner計算
	
	//connect( process,			  	SIGNAL(imageThrow(QImage)),				pivDisplay,				SLOT(displayBMP(QImage)) );						// 計算好 Gauss Filter 將資料丟給顯示
	connect( process,			  	SIGNAL(signalsGress(int)),				filterProgress,			SLOT(setValue(int)) );							// 設定進度條
	connect( process,			  	SIGNAL(signalsGress(int)),				measureProgress,		SLOT(setValue(int)) );							// 設定進度條
	connect( process,			  	SIGNAL(signalTabText(int,QString)),		this,					SLOT(setTabText(int,QString)) );				// 設定進度條

	connect( blobCombo,			  	SIGNAL(currentIndexChanged(int)),		this,					SLOT(setBlobmethod(int)) );						// 設定現在執行的是哪一個blob detector
	connect( waterCheck,		  	SIGNAL(stateChanged(int)),				this,					SLOT(setHighlight(int)) );						// 設定是否要反白
	connect( waterCombo,		  	SIGNAL(currentIndexChanged(int)),		this,					SLOT(setWatershed(int)) );						// 設定哪個watershed方法  4.8 4.1 mser


	// 把訊息印到除錯訊息的地方   append  or   setText
	connect( filedata,   			SIGNAL(debugSignal(QString)),     		text_debug,				SLOT(append(QString)) );
	connect( process,    			SIGNAL(debugSignal(QString)),     		text_debug,				SLOT(append(QString)) );
	connect( progress,	 			SIGNAL(debugSignal(QString)),	   		text_debug,				SLOT(append(QString)) );

	// 這邊跟顯示畫面 pointlist有關
	for( i = 0; i < 2; i++ )
		connect( display[i],			SIGNAL(mousePressed(PIXEL)),			this,					SLOT(addPixel(PIXEL)) );					// 點擊畫面 更新資料
	connect( progress,				SIGNAL(updateWidgeB()),					pointList[1],			SLOT(updatePointList()) );						// 將資料顯示到 point list (output)
	//connect( pointList[0],			SIGNAL(cellClicked(int,int)),			this,					SLOT(removePointList(int,int)) );				// 點擊 point list (input) 刪除點資料
	// 陰影檢測用 改成點擊到的時候顯示該區域到顯示區
	connect( pointList[0],			SIGNAL(cellClicked(int,int)),			this,					SLOT(view_square(int,int)) );
	connect( removeButton,			SIGNAL(clicked()),						this,					SLOT(remove_square()) );						// 移除某個square
	connect( clearButton,			SIGNAL(clicked()),						this,					SLOT(clearData()) );							// 按下clear按鈕  清空資料
	connect( inhenceCheck,			SIGNAL(stateChanged(int)),				settings,				SLOT(setInhence(int)) );						// 設定inhencement  判斷是抓單點陰影 還是整段的陰影 (應付noise很強 跟noise不強的case)
	connect( saveCheck,				SIGNAL(stateChanged(int)),				settings,				SLOT(setSaved(int))	);							// 設定是否要將結果輸出到檔案 (image部分)
	connect( batchCheck,			SIGNAL(stateChanged(int)),				settings,				SLOT(setBatch(int)) );							// 設定是否為批次作業
	
    // Importing
   // connect(importButton,			SIGNAL(clicked()),						this,					SLOT(launchImageImport()));
   // connect(filedata,				SIGNAL(imagesImported()),				this,					SLOT(notifyFolderChange()));

    connect(vectorListWidget, SIGNAL(fileClicked(int)), this, SLOT(vectorClicked(int)));

    // The following should be moved into settings
    //
    connect(colourButtonFiltered, SIGNAL(clicked()), this, SLOT(chooseFilteredColour()));
    connect(colourButtonUnfiltered, SIGNAL(clicked()), this, SLOT(chooseUnfilteredColour()));
    connect(scaleSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorScale(double)));
    connect(subSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorSub(double)));

    // Process tab
    connect(hSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthX(int)));
    connect(vSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthY(int)));
    connect(hSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaX(int)));
    connect(vSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaY(int)));


    // DoingPIV
    connect(outputFolderEdit, SIGNAL(textEdited(QString)), this, SLOT(setOutput()));
    connect(outputFolderButton, SIGNAL(clicked()), this, SLOT(chooseOutputFolder()));
    connect(outputFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setOutput()));


    connect(batchButton, SIGNAL(clicked()), process, SLOT(launchBatchWindow()));
    connect(process, SIGNAL(batchProcessed()), this, SLOT(batchDone()));


	//for( i = 0; i < displaySize; i++ )
	//	connect(display[i],   	SIGNAL(mousePressed(PIXEL)),			this,			SLOT(updatePositionPixel(PIXEL)));				// Andrea修改  點一下滑鼠,把RGB資訊輸入進去.


	/*connect(pivDisplay,   	SIGNAL(mousePressed(QPointF)),			this,			SLOT(uptdaePositionRGB(QPointF)));				// Andrea修改  點一下滑鼠,把RGB資訊輸入進去.
	connect(pivDisplay_2,  	SIGNAL(mousePressed(QPointF)),			this,			SLOT(uptdaePositionRGB(QPointF)));				// Andrea修改  點一下滑鼠,把RGB資訊輸入進去.   用在視窗2
	connect(pivDisplay,   	SIGNAL(mousePressed(QPointF)),			this,			SLOT(updatePositionXY(QPointF)));				// Andrea修改  點一下滑鼠,把座標輸入進去.
	connect(pivDisplay_2,  	SIGNAL(mousePressed(QPointF)),			this,			SLOT(updatePositionXY(QPointF)));				// Andrea修改  點一下滑鼠,把座標輸入進去.   用在視窗2*/



	//connect(pivDisplay,   	SIGNAL(mousePressed(QPointF)),			pivDisplay,		SLOT(mark_XY(QPointF)));						// Andrea修改  點一下滑鼠, 在上面標記點
	//connect(pivDisplay_2,  	SIGNAL(mousePressed(QPointF)),			pivDisplay_2,	SLOT(mark_XY(QPointF)));						// Andrea修改  點一下滑鼠, 在上面標記點    用在視窗2



	connect(this,			SIGNAL(set_measure_X(int)),				measureX,		SLOT(setValue(int) ) );							// 設定 X 座標的spinbox
	connect(this,			SIGNAL(set_measure_Y(int)),				measureY,		SLOT(setValue(int) ) );							// 設定 Y 座標的spinbox
	

}
void MainWindow::setupConnections()
{
    // Importing
    connect(importButton, SIGNAL(clicked()), this, SLOT(launchImageImport()));
    connect(filedata, SIGNAL(imagesImported()), aListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), bListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), vectorListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), this, SLOT(notifyFolderChange()));
    connect(filedata, SIGNAL(vectorListUpdated()), vectorListWidget, SLOT(update()));

    // Image selection
    connect(aListWidget, SIGNAL(fileClicked(int)), this, SLOT(pivAclicked(int)));
    connect(bListWidget, SIGNAL(fileClicked(int)), this, SLOT(pivBclicked(int)));
    connect(vectorListWidget, SIGNAL(fileClicked(int)), this, SLOT(vectorClicked(int)));
    connect(forwardButton, SIGNAL(clicked()), this, SLOT(forwardOne()));
    connect(backButton, SIGNAL(clicked()), this, SLOT(backwardOne()));

    // Image/vector viewing
    connect(zoomInButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomIn()));
    connect(zoomOutButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomOut()));
    connect(zoomFitButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomFit()));
    // The following should be moved into settings
    connect(vectorToggle, SIGNAL(toggled(bool)), pivDisplay, SLOT(vectorsToggled(bool)));
    //
    connect(colourButtonFiltered, SIGNAL(clicked()), this, SLOT(chooseFilteredColour()));
    connect(colourButtonUnfiltered, SIGNAL(clicked()), this, SLOT(chooseUnfilteredColour()));
    connect(scaleSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorScale(double)));
    connect(subSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorSub(double)));
    connect(settings, SIGNAL(vectorSettingChanged()), pivDisplay, SLOT(vectorsChanged()));

    // Masking
    connect(maskButton, SIGNAL(clicked()), maskButton, SLOT(showMenu()));
    connect(filedata,SIGNAL(imagesImported()), maskDropDown, SLOT(imageLoaded()));
    connect(maskDropDown, SIGNAL(importMaskClicked()), filedata, SLOT(importMask()));
    connect(filedata, SIGNAL(maskLoaded()), maskDropDown, SLOT(maskLoaded()));
    connect(maskDropDown, SIGNAL(gridToggled(bool)), pivDisplay, SLOT(maskToggled(bool)));
    connect(maskDropDown, SIGNAL(clearMask(bool)), settings, SLOT(setIsMask(bool)));

    // Process tab
    connect(hSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthX(int)));
    connect(vSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthY(int)));
    connect(hSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaX(int)));
    connect(vSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaY(int)));

    // Filter tab
    connect(globalRangeCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(minUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(maxUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(minVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(maxVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(globalStDevCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(nStdDevSpin, SIGNAL(valueChanged(double)), this, SLOT(setFilterValues()));

    connect(localCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(localMethodCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(localNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(localUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(localVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));

    connect(interpolateCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(interpolateMethodCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(interpolateNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));

    connect(smoothCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(smoothRadiusEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(smoothNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));

    // DoingPIV
    connect(outputFolderEdit, SIGNAL(textEdited(QString)), this, SLOT(setOutput()));
    connect(outputFolderButton, SIGNAL(clicked()), this, SLOT(chooseOutputFolder()));
    connect(outputFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setOutput()));
    connect(correlateButton, SIGNAL(clicked()), process, SLOT(processCurrentImagePair()));
    connect(process, SIGNAL(currentProcessed()), pivDisplay, SLOT(displayCurrent()));
    connect(process, SIGNAL(currentProcessed()), output, SLOT(outputCurrent()));
    connect(filterButton, SIGNAL(clicked()), analysis, SLOT(filterCurrent()));
    connect(analysis, SIGNAL(currentFiltered()), pivDisplay, SLOT(displayCurrent()));
    connect(analysis, SIGNAL(currentFiltered()), output, SLOT(outputCurrent()));
    connect(batchButton, SIGNAL(clicked()), process, SLOT(launchBatchWindow()));
    connect(process, SIGNAL(batchProcessed()), this, SLOT(batchDone()));
    connect(pivDisplay, SIGNAL(mouseMoved(QPointF)), this, SLOT(updatePositionLabel(QPointF)));

    // Data Quality
    connect(filterSNRCheck, SIGNAL(toggled(bool)), this, SLOT(qualityChanged()));
    connect(snrEdit, SIGNAL(textEdited(QString)), this, SLOT(qualityChanged()));
    connect(filterIntCheck, SIGNAL(toggled(bool)), this, SLOT(qualityChanged()));
    connect(intensityEdit, SIGNAL(textEdited(QString)), this, SLOT(qualityChanged()));
}