TargetList::TargetList(QWidget *parent) : QWidget(parent) { targetTable = new QTableWidget(1,3,this); scanLocTable = new QTableWidget(1,5,this); QLabel* targetTableLabel = new QLabel("&Targets"); QLabel* scanLocTableLabel = new QLabel("ROI locations"); QStringList ttHeaders; ttHeaders.append("Target Number"); ttHeaders.append("x (um)"); ttHeaders.append("y (um)"); targetTable->setHorizontalHeaderLabels(ttHeaders); QStringList sltHeaders; sltHeaders.append("ROI Number"); sltHeaders.append("x (um)"); sltHeaders.append("y (um)"); sltHeaders.append("x width"); sltHeaders.append("y width"); scanLocTable->setHorizontalHeaderLabels(sltHeaders); targetTableLabel->setBuddy(targetTable); connect(targetTable,SIGNAL(cellClicked(int,int)), this, SLOT(updateScanTable(int,int))); mainLayout = new QGridLayout; mainLayout->addWidget(targetTableLabel,0,0); mainLayout->addWidget(targetTable, 1,0,3,1); mainLayout->addWidget(scanLocTableLabel,0,1); mainLayout->addWidget(scanLocTable,1,2,3,2 ); scanLocTable->adjustSize(); targetTable->adjustSize(); setLayout(mainLayout); qDebug()<<"constructed targettable"; qDebug()<<QString::number(scanLocTable->isVisible()); LandmarkList fakeTargetList; LocationSimple testLoc1; fakeTargetList.append(testLoc1); QList<LandmarkList> fakeScanLocations; fakeScanLocations.append(fakeTargetList); updateTargetTable(fakeTargetList, fakeScanLocations); }
bool load_data(V3DPluginCallback2 *cb,unsigned char * & image1Dc_in,LandmarkList &LList,ImagePixelType &pixeltype, V3DLONG sz_img[4],v3dhandle &curwin) { V3DPluginCallback2 *callback=cb; v3dhandleList v3dhandleList_current=callback->getImageWindowList(); QList <V3dR_MainWindow *> cur_list_3dviewer = callback->getListAll3DViewers(); LandmarkList LList_in; if (v3dhandleList_current.size()==0){ v3d_msg("Please open image and select markers"); return false; } else if (v3dhandleList_current.size()==1) //One window open { //get markers and check markers LList_in.clear(); LList_in = callback->getLandmark(v3dhandleList_current[0]); if (LList_in.size()==0) { v3d_msg("Please load markers"); return false; } curwin=v3dhandleList_current[0]; } else if (v3dhandleList_current.size()>1) { QStringList items; int i; for (i=0; i<v3dhandleList_current.size(); i++) items << callback->getImageName(v3dhandleList_current[i]); for (i=0; i<cur_list_3dviewer.count(); i++) { QString curname = callback->getImageName(cur_list_3dviewer[i]).remove("3D View [").remove("]"); bool b_found=false; for (int j=0; j<v3dhandleList_current.size(); j++) if (curname==callback->getImageName(v3dhandleList_current[j])) { b_found=true; break; } if (!b_found) items << callback->getImageName(cur_list_3dviewer[i]); } //qDebug()<<"Number of items:"<<items.size(); QDialog *mydialog=new QDialog; QComboBox *combo=new QComboBox; combo->insertItems(0,items); QLabel *label_win=new QLabel; label_win->setText("You have multiple windows open, please select one image:"); QGridLayout *layout= new QGridLayout; layout->addWidget(label_win,0,0,1,1); layout->addWidget(combo,1,0,4,1); QPushButton *button_d_ok=new QPushButton("Ok"); button_d_ok->setFixedWidth(100); QPushButton *button_d_cancel=new QPushButton("Cancel"); button_d_cancel->setFixedWidth(100); QHBoxLayout *box=new QHBoxLayout; box->addWidget(button_d_ok,Qt::AlignCenter); box->addWidget(button_d_cancel,Qt::AlignCenter); layout->addLayout(box,5,0,1,1); QDialog::connect(button_d_ok,SIGNAL(clicked()),mydialog,SLOT(accept())); QDialog::connect(button_d_cancel,SIGNAL(clicked()),mydialog,SLOT(reject())); mydialog->setLayout(layout); mydialog->exec(); if (mydialog->result()==QDialog::Accepted) { int tmp=combo->currentIndex(); curwin=v3dhandleList_current[tmp]; } else { v3d_msg("You have not selected a window"); return false; } //get markers and check markers LList_in.clear(); LList_in = callback->getLandmark(curwin); if (LList_in.size()==0) { v3d_msg("Please load markers"); return false; } } //Get the image info Image4DSimple* p4DImage = callback->getImage(curwin); if (!p4DImage){ QMessageBox::information(0, "", "The image pointer is invalid. Ensure your data is valid and try again!"); return false; } sz_img[0]=p4DImage->getXDim(); sz_img[1]=p4DImage->getYDim(); sz_img[2]=p4DImage->getZDim(); sz_img[3]=p4DImage->getCDim(); if (sz_img[3]>3){ sz_img[3]=3; QMessageBox::information(0,"","More than 3 channels were loaded." "The first 3 channel will be applied for analysis."); } V3DLONG size_tmp=sz_img[0]*sz_img[1]*sz_img[2]*sz_img[3]; pixeltype = p4DImage->getDatatype(); image1Dc_in=memory_allocate_uchar1D(size_tmp); unsigned char * ptmp=p4DImage->getRawData(); memcpy(image1Dc_in,ptmp,size_tmp*pixeltype); LList.clear(); for(int i=0; i<LList_in.size(); i++){ LList.append(LList_in.at(i)); LList[i].color.r=196; LList[i].color.g=LList[i].color.b=0; } return true; }