本文整理汇总了C++中V3DPluginCallback2类的典型用法代码示例。如果您正苦于以下问题:C++ V3DPluginCallback2类的具体用法?C++ V3DPluginCallback2怎么用?C++ V3DPluginCallback2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了V3DPluginCallback2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: runtime_error
// Get the current V3D image window
/* static */ ImageWindow ImageWindow::current()
{
V3DPluginCallback2* callback = v3d::get_plugin_callback();
if (! callback)
throw std::runtime_error("No V3D callback handler");
return ImageWindow(callback->currentImageWindow());
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:8,代码来源:wrappable_v3d.cpp
示例2: Invert
void Invert(V3DPluginCallback2 &v3d, QWidget *parent)
{
v3dhandle oldwin = v3d.currentImageWindow();
Image4DSimple* image = v3d.getImage(oldwin);
if (! image)
{
QMessageBox::information(0, title, QObject::tr("No image is open."));
return;
}
// if (image->getDatatype()!=V3D_UINT8)
// {
// QMessageBox::information(0, title, QObject::tr("This demo program only supports 8-bit data. Your current image data type is not supported."));
// return;
// }
Image4DProxy<Image4DSimple> p(image);
// for (uint8* ip=p.begin(); ip<=p.end(); ip++)
// {
// *ip = 255 - *ip;
// }
Image4DProxy_foreach(p, x,y,z,c)
{
double f = 0;
if (p.is_inner(x,y,z,c)) f = p.value_at(x,y,z,c);
f = 255-f;
p.put_at(x,y,z,c, (f));
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:29,代码来源:newwindowplugin.cpp
示例3: setSeeds
void setSeeds(V3DPluginCallback2 &v3d, QWidget *parent )
{
v3dhandle curwin = v3d.currentImageWindow();
if (!curwin)
{
v3d_msg("You don't have any image open in the main window.");
return;
}
//ensure the 3d viewer window is open; if not, then open it
v3d.open3DWindow(curwin);
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:12,代码来源:mostVesselTracer.cpp
示例4: SynTwoImage
void SynTwoImage(V3DPluginCallback2 &v3d, QWidget *parent)
{
v3dhandleList win_list = v3d.getImageWindowList();
if (win_list.size()<2)
{
v3d_msg("You need at least two opened images to synchronize their 3D views!");
return;
}
if (panel)
{
panel->show();
return;
}
else
{
panel = new lookPanel(v3d, parent);
if (panel)
{
panel->show();
panel->raise();
panel->move(100,100);
panel->activateWindow();
}
}
}
开发者ID:CBL-ORION,项目名称:vaa3d_tools,代码行数:26,代码来源:sync3D_plugin.cpp
示例5: compute
int compute(V3DPluginCallback2 &callback, QWidget *parent)
{
v3dhandle curwin;
curwin=callback.currentImageWindow();
if(!curwin)
{
v3d_msg("No V3D window is available for returning data ... Do nothing.", 0);
return -1;
}
Image4DSimple *p4DImage = callback.getImage(curwin);
if (p4DImage->getDatatype()!=V3D_UINT8)
{
v3d_msg("Now we only support 8 bit image.\n");
return -1;
}
//TODO add datatype judgment
double max_value = 256;
V3DLONG histscale = 256;
QVector<QVector<int> > hist_vec;
QStringList labelsLT;
int nChannel = p4DImage->getCDim();
V3DLONG sz[3];
sz[0] = p4DImage->getXDim();
sz[1] = p4DImage->getYDim();
sz[2] = p4DImage->getZDim();
for (int c=0;c<nChannel;c++)
{
unsigned char * inimg1d = p4DImage->getRawDataAtChannel(c);
QVector<int> tmp;
getHistogram(inimg1d, sz[0]*sz[1]*sz[2], max_value, histscale, tmp);
hist_vec.append(tmp);
labelsLT.append(QString("channel %1").arg(c+1));
}
QString labelRB = QString("%1").arg(max_value);
histogramDialog * dlg = new histogramDialog(hist_vec, labelsLT, labelRB, parent, QSize(500,150), QColor(50,50,50));
dlg->setWindowTitle(QObject::tr("Histogram"));
dlg->show();
return 1;
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:46,代码来源:histogram_func.cpp
示例6: dosearch
void border_tips::dosearch(V3DPluginCallback2 &callback, QWidget *parent)
{
//select the window to operate
QList <V3dR_MainWindow *> allWindowList = callback.getListAll3DViewers();
QList <V3dR_MainWindow *> selectWindowList;
V3dR_MainWindow * v3dwin;
QList<NeuronTree> * ntTreeList;
int winid;
qDebug("search for 3D windows");
for (V3DLONG i=0;i<allWindowList.size();i++)
{
ntTreeList = callback.getHandleNeuronTrees_Any3DViewer(allWindowList[i]);
if(ntTreeList->size()>0)
selectWindowList.append(allWindowList[i]);
}
qDebug("match and select 3D windows");
if(selectWindowList.size()<1){
v3d_msg("Cannot find 3D view with SWC file. Please load the SWC file you want to identify border tips on.");
return;
}else if(selectWindowList.size()>1){
//pop up a window to select
QStringList items;
for(int i=0; i<selectWindowList.size(); i++){
items.append(callback.getImageName(selectWindowList[i]));
}
bool ok;
QString selectitem = QInputDialog::getItem(parent, QString::fromUtf8("Neuron Stitcher"), QString::fromUtf8("Select A Window to Operate"), items, 0, false, &ok);
if(!ok) return;
for(int i=0; i<selectWindowList.size(); i++){
if(selectitem==callback.getImageName(selectWindowList[i]))
{
winid=i;
break;
}
}
}else{
winid=0;
}
v3dwin = selectWindowList[winid];
neuron_tipspicker_dialog * myDialog = NULL;
myDialog = new neuron_tipspicker_dialog(&callback, v3dwin);
myDialog->show();
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:45,代码来源:border_tips_plugin.cpp
示例7: MovieFrom3Dviewer
void MovieFrom3Dviewer(V3DPluginCallback2 & v3d, QWidget * parent)
{
v3dhandle curwin = v3d.currentImageWindow();
if (!curwin)
{
v3d_msg("You don't have any image open in the main window.");
return;
}
v3d.open3DWindow(curwin);
if (controlPanel::m_pLookPanel)
{
controlPanel::m_pLookPanel->show();
return;
}
controlPanel* p = new controlPanel(v3d, parent);
if (p) p->show();
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:19,代码来源:plugin_moviefrom3dviewer.cpp
示例8: SnapShoot3Dviewer
void SnapShoot3Dviewer(V3DPluginCallback2 & v3d, QWidget * parent)
{
v3dhandle curwin = v3d.currentImageWindow();
if (!curwin)
{
v3d_msg("You don't have any image opened in the main window.");
return;
}
v3d.open3DWindow(curwin);
QFileDialog d(parent);
d.setWindowTitle(QObject::tr("Choose output snapshot filename"));
d.setAcceptMode(QFileDialog::AcceptSave);
if (!d.exec()) return;
QString BMPfilename = (d.selectedFiles())[0];
if (BMPfilename.endsWith(".BMP", Qt::CaseInsensitive))
BMPfilename.resize(BMPfilename.length()-4); //by PHC
v3d.screenShot3DWindow(curwin, BMPfilename);
QMessageBox::information(0, title, QString("Snapshot was saved to: %1.BMP\n").arg(BMPfilename));
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:21,代码来源:plugin_moviefrom3dviewer.cpp
示例9: processImage
void processImage(V3DPluginCallback2 &callback)
{
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
QMessageBox::information(0, "", "You don't have any image open in the main window.");
return;
}
Image4DSimple* p4DImage = callback.getImage(curwin);
if (!p4DImage)
{
QMessageBox::information(0, "", "The image pointer is invalid. Ensure your data is valid and try again!");
return;
}
unsigned char* data1d = p4DImage->getRawData();
V3DLONG N = p4DImage->getXDim();
V3DLONG M = p4DImage->getYDim();
V3DLONG P = p4DImage->getZDim();
ImagePixelType pixeltype = p4DImage->getDatatype();
// display new this was copied from plug_watershed and is substantially different
// from ZZs local enhancement code.
Image4DSimple new4DImage;
new4DImage.setData((unsigned char *)data1d,N, M, P, 1, pixeltype);
v3dhandle newwin = callback.newImageWindow();
callback.setImage(newwin, &new4DImage);
callback.setImageName(newwin, QString("Local_adaptive_enhancement_result"));
callback.updateImageWindow(newwin);
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:34,代码来源:BRL00_plugin.cpp
示例10: snapShots3Dviewer
void snapShots3Dviewer(V3DPluginCallback2 & v3d, QWidget * parent)
{
QFileDialog inANO_d(parent);
inANO_d.setWindowTitle(QObject::tr("Choose input ano filename"));
inANO_d.setAcceptMode(QFileDialog::AcceptOpen);
if (!inANO_d.exec()) return;
QString inANO_fn = (inANO_d.selectedFiles())[0];
P_ObjectFileType cc;
if(! loadAnoFile(inANO_fn,cc)){
cout <<"Fail to load ano file" <<endl;
return;
}
QString output_d=QFileDialog::getExistingDirectory(parent,
QString(QObject::tr("Choose the output directory, where the snapshots would be saved.")));
float x_rot = QInputDialog::getDouble(parent, "Roation about x axis",
"Rotation about x :",
90, -180, 180);
float y_rot = QInputDialog::getDouble(parent, "Roation about y axis",
"Rotation about y :",
0, -180, 180);
float z_rot = QInputDialog::getDouble(parent, "Roation about z axis",
"Rotation about z :",
90, -180, 180);
for(int i = 0; i <cc.swc_file_list.size(); i++)
{
QString swc_file = cc.swc_file_list[i];
v3d.open3DViewerForSingleSurfaceFile(swc_file);
QList<V3dR_MainWindow * > list_3dviewer = v3d.getListAll3DViewers();
V3dR_MainWindow * surface_win = list_3dviewer[i];
if (!surface_win)
{
cout << "surface_win is empty"<<endl;
}
View3DControl *view = v3d.getView3DControl_Any3DViewer(surface_win);
view->doAbsoluteRot(x_rot,y_rot,z_rot);
swc_file = QFileInfo(swc_file).fileName();
QString BMPfilename = QDir(output_d).absolutePath()+ '/'+swc_file;
// v3d_msg(BMPfilename);
v3d.update_3DViewer(surface_win);
v3d.screenShot_Any3DViewer(surface_win, BMPfilename);
v3d.close3DWindow(surface_win);
}
}
开发者ID:CBL-ORION,项目名称:vaa3d_tools-1,代码行数:58,代码来源:snapshots_3dviewer.cpp
示例11: qDebug
void SetNeuronDisplayColor::do1clickcolor(V3DPluginCallback2 &callback, QWidget *parent)
{
//select the window to operate
QList <V3dR_MainWindow *> allWindowList = callback.getListAll3DViewers();
QList <V3dR_MainWindow *> selectWindowList;
V3dR_MainWindow * v3dwin;
QList<NeuronTree> * ntTreeList;
int winid;
qDebug("search for 3D windows");
for (V3DLONG i=0;i<allWindowList.size();i++)
{
ntTreeList = callback.getHandleNeuronTrees_Any3DViewer(allWindowList[i]);
if(ntTreeList->size()>0)
selectWindowList.append(allWindowList[i]);
}
qDebug("match and select 3D windows");
if(selectWindowList.size()<1){
v3d_msg("Cannot find 3D view with SWC file. Please load the SWC files you want to color in the 3D view");
return;
}else if(selectWindowList.size()>1){
//pop up a window to select
QStringList items;
for(int i=0; i<selectWindowList.size(); i++){
items.append(callback.getImageName(selectWindowList[i]));
}
bool ok;
QString selectitem = QInputDialog::getItem(parent, QString::fromUtf8("1-click neuron color"), QString::fromUtf8("Select A Window to Operate"), items, 0, false, &ok);
if(!ok) return;
for(int i=0; i<selectWindowList.size(); i++){
if(selectitem==callback.getImageName(selectWindowList[i]))
{
winid=i;
break;
}
}
}else{
winid=0;
}
v3dwin = selectWindowList[winid];
//load neuron tree
ntTreeList=callback.getHandleNeuronTrees_Any3DViewer(v3dwin);
for(int i=0; i<ntTreeList->size(); i++){
NeuronTree* p = (NeuronTree*)&(ntTreeList->at(i));
int k=i%8;
p->color.r=R_table[k];
p->color.g=G_table[k];
p->color.b=B_table[k];
p->color.a=255;
}
qDebug("Done Setting Color");
callback.update_3DViewer(v3dwin);
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:54,代码来源:neuron_color_display_plugin.cpp
示例12: open_sec_editor
int open_sec_editor(V3DPluginCallback2 &callback, QWidget *parent)
{
v3dhandleList win_list = callback.getImageWindowList();
if(win_list.size()<1)
{
QMessageBox::information(0, title, QObject::tr("No image is open."));
return -1;
}
SWCEditorWidget * w = new SWCEditorWidget(callback, parent);
w->show();
//TestDialog dialog(callback, parent);
//if (dialog.exec()!=QDialog::Accepted) return -1;
//dialog.update();
//int i = dialog.i;
//int c = dialog.channel;
//Image4DSimple *p4DImage = callback.getImage(win_list[i]);
//if(p4DImage->getCDim() <= c) {v3d_msg(QObject::tr("The channel isn't existed.")); return -1;}
//V3DLONG sz[3];
//sz[0] = p4DImage->getXDim();
//sz[1] = p4DImage->getYDim();
//sz[2] = p4DImage->getZDim();
//unsigned char * inimg1d = p4DImage->getRawDataAtChannel(c);
//v3dhandle newwin;
//if(QMessageBox::Yes == QMessageBox::question(0, "", QString("Do you want to use the existing windows?"), QMessageBox::Yes, QMessageBox::No))
//newwin = callback.currentImageWindow();
//else
//newwin = callback.newImageWindow();
//p4DImage->setData(inimg1d, sz[0], sz[1], sz[2], sz[3]);
//callback.setImage(newwin, p4DImage);
//callback.setImageName(newwin, QObject::tr("open_sec_editor"));
//callback.updateImageWindow(newwin);
return 1;
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:39,代码来源:swc_editor_func.cpp
示例13: domenu
void RivuletPlugin::domenu(const QString &menu_name, V3DPluginCallback2 &callback, QWidget *parent)
{
if (menu_name == tr("tracing"))
{
bool bmenu = true;
input_PARA PARA;
if(callback.getImageWindowList().empty())
{
v3d_msg("Oops... No image opened in V3D...");
return;
}
PARA_RIVULET p;
// fetch parameters from dialog
if (!p.rivulet_dialog())
return;
PARA.threshold = p.threshold;
PARA.connectrate = p.connectrate;
PARA.percentage = p.percentage;
PARA.dumpbranch = p.dumpbranch;
PARA.gap = p.gap;
PARA.stepsize = p.stepsize;
PARA.channel = p.channel;
PARA.sigma = p.sigmavalue;
PARA.alpha_one = p.alpha_one_value;
PARA.alpha_two = p.alpha_two_value;
reconstruction_func(callback,parent,PARA,bmenu);
}
else
{
v3d_msg(tr("Rivulet algorithm for 3D neuron tracing. . "
"Developed by Siqi Liu, Donghao Zhang, 2015-8-25"));
}
}
开发者ID:CBL-ORION,项目名称:vaa3d_tools-1,代码行数:36,代码来源:Rivulet_plugin.cpp
示例14: reconstruction_func
void reconstruction_func(V3DPluginCallback2 &callback, QWidget *parent, input_PARA &PARA, bool bmenu)
{
unsigned char* data1d = 0;
V3DLONG N,M,P,sc,c;
V3DLONG in_sz[4];
int datatype = 0;
if(bmenu)
{
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
QMessageBox::information(0, "", "You don't have any image open in the main window.");
return;
}
Image4DSimple* p4DImage = callback.getImage(curwin);
if (!p4DImage)
{
QMessageBox::information(0, "", "The image pointer is invalid. Ensure your data is valid and try again!");
return;
}
data1d = p4DImage->getRawData();
N = p4DImage->getXDim();
M = p4DImage->getYDim();
P = p4DImage->getZDim();
sc = p4DImage->getCDim();
datatype = (int) p4DImage->getDatatype();
bool ok1;
if(sc==1)
{
c=1;
ok1=true;
}
else
{
c = QInputDialog::getInteger(parent, "Channel",
"Enter channel NO:",
1, 1, sc, 1, &ok1);
}
if(!ok1)
return;
in_sz[0] = N;
in_sz[1] = M;
in_sz[2] = P;
in_sz[3] = sc;
PARA.inimg_file = p4DImage->getFileName();
}
else
{
if (!simple_loadimage_wrapper(callback,PARA.inimg_file.toStdString().c_str(), data1d, in_sz, datatype))
{
fprintf (stderr, "Error happens in reading the subject file [%s]. Exit. \n",PARA.inimg_file.toStdString().c_str());
return;
}
if(PARA.channel < 1 || PARA.channel > in_sz[3])
{
fprintf (stderr, "Invalid channel number. \n");
return;
}
N = in_sz[0];
M = in_sz[1];
P = in_sz[2];
sc = in_sz[3];
c = PARA.channel;
}
if(datatype!=1){
v3d_msg(QString("Now only support image type UINT8."),bmenu);
return;
}
//main neuron reconstruction code
QString swc_name=PARA.inimg_file+"_smartTracing";
nt_selfcorrect_func tracefunc;
tracefunc.smart_tracing(PARA.inimg_file,swc_name,&callback,c-1);
if(!bmenu)
{
if(data1d) {delete []data1d; data1d = 0;}
}
if(tracefunc.error_code==0)
{
v3d_msg(QString("Now you can drag and drop the generated swc fle [%1] into Vaa3D.").arg(swc_name.toStdString().c_str()),bmenu);
}else{
QString error_msg;
switch(tracefunc.error_code){
case 1:
error_msg="Failed to call APP2 tracing function. Please check if plugin Vaa3D_Neuron2 is installed correctly.";
break;
case 2:
error_msg="Failed to run SVM. Please check your configuration.";
//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:101,代码来源:smartTrace_plugin.cpp
示例15: domenu
void IBioformatIOPlugin::domenu(const QString &menu_name, V3DPluginCallback2 &callback, QWidget *parent)
{
if (menu_name == tr("load an image using Bioformats Java library"))
{
// input
QString m_FileName = QFileDialog::getOpenFileName(parent, QObject::tr("Open An Image"),
QDir::currentPath(),
QObject::tr("Image File (*.*)"));
if(m_FileName.isEmpty())
{
printf("\nError: Your image does not exist!\n");
return;
}
// temp
QString baseName = QFileInfo(m_FileName).baseName();
QString tmpfile = QDir::tempPath().append("/").append(baseName).append(".tif");
//
QFile tmpqfile(tmpfile);
if (tmpqfile.exists()) system(qPrintable(QString("rm -f \"%1\"").arg(tmpfile)));
//look for loci_tools.jar
QString lociDir = ("loci_tools.jar");
if (!QFile(lociDir).exists())
{
printf("loci_tools.jar is not in current directory, search v3d app path.\n");
lociDir = getAppPath().append("/loci_tools.jar");
printf(qPrintable(lociDir));
printf("\n");
if (!QFile(lociDir).exists())
{
v3d_msg("Cannot find loci_tools.jar, please download it and make sure it is put under the Vaa3D executable folder, parallel to the Vaa3D executable and the plugins folder.");
return;
}
}
#if defined(Q_OS_WIN32)
QSettings settings("HHMI", "Vaa3D");
QString fileOpenName = settings.value("JavaPath").toString();
if(fileOpenName.isEmpty())
{
fileOpenName = QFileDialog::getOpenFileName(0, QObject::tr("Open Java Executable File"),
"",
QObject::tr("Supported file (*.exe)"
));
if(fileOpenName.isEmpty())
return;
settings.setValue("JavaPath", fileOpenName);
}
QString cmd_loci = QString("\"\"%1\" -cp \"%2\" loci.formats.tools.ImageConverter \"%3\" \"%4\"\"").arg(fileOpenName.toStdString().c_str()).arg(lociDir.toStdString().c_str()).arg(m_FileName.toStdString().c_str()).arg(tmpfile.toStdString().c_str());
#else
QString cmd_loci = QString("java -cp \"%1\" loci.formats.tools.ImageConverter \"%2\" \"%3\"").arg(lociDir.toStdString().c_str()).arg(m_FileName.toStdString().c_str()).arg(tmpfile.toStdString().c_str());
#endif
v3d_msg(cmd_loci, 0);
system(qPrintable(cmd_loci));
if (!tmpqfile.exists())
{
v3d_msg("The temprary file does not exist. The conversion of format using Bioformats has failed. Please sue another way to convert and load using Vaa3D.\n");
return;
}
// load
V3DLONG sz_relative[4];
int datatype_relative = 0;
unsigned char* relative1d = 0;
if (simple_loadimage_wrapper(callback, const_cast<char *>(tmpfile.toStdString().c_str()), relative1d, sz_relative, datatype_relative)!=true)
{
fprintf (stderr, "Error happens in reading the subject file [%s]. Exit. \n",tmpfile.toStdString().c_str());
return;
}
// visualize
Image4DSimple p4DImage;
if(datatype_relative == V3D_UINT8)
{
p4DImage.setData((unsigned char*)relative1d, sz_relative[0], sz_relative[1], sz_relative[2], sz_relative[3], V3D_UINT8);
}
else if(datatype_relative == V3D_UINT16)
{
p4DImage.setData((unsigned char*)relative1d, sz_relative[0], sz_relative[1], sz_relative[2], sz_relative[3], V3D_UINT16);
}
else if(datatype_relative == V3D_FLOAT32)
{
p4DImage.setData((unsigned char*)relative1d, sz_relative[0], sz_relative[1], sz_relative[2], sz_relative[3], V3D_FLOAT32);
}
else
{
printf("\nError: The program only supports UINT8, UINT16, and FLOAT32 datatype.\n");
return;
}
//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:101,代码来源:iBioformatIO.cpp
示例16: processImage
void processImage(V3DPluginCallback2 &callback, QWidget *parent, unsigned int rotateflag)
{
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
QMessageBox::information(0, "", "You don't have any image open in the main window.");
return;
}
Image4DSimple* image = callback.getImage(curwin);
if (!image)
{
QMessageBox::information(0, "", "The image pointer is invalid. Ensure your data is valid and try again!");
return;
}
unsigned char* data1d = image->getRawData();
V3DLONG szx = image->getXDim(), szy = image->getYDim(), szz = image->getZDim(), szc = image->getCDim();
// V3DLONG szchan = image->getTotalUnitNumberPerChannel(), szplane = image->getTotalUnitNumberPerPlane();
// V3DLONG N = image->getTotalBytes();
// V3DLONG i,j,k,c;
if (!data1d || szx<=0 || szy<=0 || szz<=0 || szc<=0)
{
throw("Your data to the plugin is invalid. Check the program.");
return;
}
ImagePixelType pixeltype = image->getDatatype();
V3DLONG in_sz[4];
in_sz[0]=szx; in_sz[1]=szy; in_sz[2]=szz; in_sz[3]=szc;
unsigned char* outimg=0;
rotateimage(data1d, in_sz, pixeltype, rotateflag, outimg);
// image->setData(outimg, szy, szx, szz, szc, image->getDatatype());
// display
Image4DSimple * new4DImage = new Image4DSimple();
switch(rotateflag)
{
case 1:
new4DImage->setData((unsigned char*)outimg, szy, szx, szz, szc, image->getDatatype());
break;
case 2:
new4DImage->setData((unsigned char*)outimg, szy, szx, szz, szc, image->getDatatype());
break;
case 3:
new4DImage->setData((unsigned char*)outimg, szx, szy, szz, szc, image->getDatatype());
break;
default:
break;
}
v3dhandle newwin = callback.newImageWindow();
callback.setImage(newwin, new4DImage);
callback.setImageName(newwin, title);
callback.updateImageWindow(newwin);
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:64,代码来源:rotateimg90.cpp
示例17: docolor
void neuron_render_ESWC_features::docolor(V3DPluginCallback2 &callback, QWidget *parent)
{
//select the window to operate
QList <V3dR_MainWindow *> allWindowList = callback.getListAll3DViewers();
QList <V3dR_MainWindow *> selectWindowList;
V3dR_MainWindow * v3dwin;
QList<NeuronTree> * ntTreeList;
int winid;
qDebug("search for 3D windows");
for (V3DLONG i=0;i<allWindowList.size();i++)
{
ntTreeList = callback.getHandleNeuronTrees_Any3DViewer(allWindowList[i]);
if(ntTreeList->size()>0){
qDebug()<<"cojoc:";
for(V3DLONG j=0; j<ntTreeList->size(); j++){
if(ntTreeList->at(j).listNeuron.at(0).fea_val.size()>0){
selectWindowList.append(allWindowList[i]);
break;
}
}
qDebug()<<"cojoc:";
qDebug()<<ntTreeList->at(0).listNeuron.at(0).fea_val.size();
}
}
qDebug("match and select 3D windows");
if(selectWindowList.size()<1){
v3d_msg("Cannot find 3D view with eligible ESWC file. Please load the ESWC files with features you want to display 3D view");
return;
}else if(selectWindowList.size()>1){
//pop up a window to select
QStringList items;
for(int i=0; i<selectWindowList.size(); i++){
items.append(callback.getImageName(selectWindowList[i]));
}
bool ok;
QString selectitem = QInputDialog::getItem(parent, QString::fromUtf8("Color Render ESWC"), QString::fromUtf8("Select A Window to Operate"), items, 0, false, &ok);
if(!ok) return;
for(int i=0; i<selectWindowList.size(); i++){
if(selectitem==callback.getImageName(selectWindowList[i]))
{
winid=i;
break;
}
}
}else{
winid=0;
}
v3dwin = selectWindowList[winid];
V3DLONG nid=0;
ntTreeList = callback.getHandleNeuronTrees_Any3DViewer(v3dwin);
QList<V3DLONG> selectNeuronList;
for(V3DLONG j=0; j<ntTreeList->size(); j++){
if(ntTreeList->at(j).listNeuron.at(0).fea_val.size()>0){
selectNeuronList.append(j);
}
}
if(selectNeuronList.size()>1){
//pop up a window to select
QStringList items;
for(int i=0; i<selectNeuronList.size(); i++){
items.append(QString::number(i+1)+": "+ntTreeList->at(selectNeuronList.at(i)).file);
}
bool ok;
QString selectitem = QInputDialog::getItem(parent, QString::fromUtf8("Color Render ESWC"), QString::fromUtf8("Select A Neuron to Color"), items, 0, false, &ok);
if(!ok) return;
for(int i=0; i<selectNeuronList.size(); i++){
if(selectitem==items.at(i))
{
nid==selectNeuronList.at(i);
break;
}
}
}else{
nid=selectNeuronList.at(0);
}
color_render_ESWC_dialog * myDialog = NULL;
myDialog = new color_render_ESWC_dialog(&callback, v3dwin, nid);
myDialog->show();
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:82,代码来源:color_render_ESWC_features_plugin.cpp
示例18: if
void brl00::domenu(const QString &menu_name, V3DPluginCallback2 &callback, QWidget *parent)
{
if (menu_name == tr("Select ROI"))
{
// check what's up with the current window
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
QMessageBox::information(0, "", "You don't have an image open in the main window.");
return;
}
Image4DSimple* p4DImage = callback.getImage(curwin);
if (!p4DImage)
{
QMessageBox::information(0, "", "The image pointer is invalid.");
return;
}
// first need to select an ROI... this should be an existing command with the callback as an argument
// apparently there's a lot of overhead for this...
// declearing stuff...
V3DPluginArgItem arg;
V3DPluginArgList input;
V3DPluginArgList output;
unsigned char * data1d_loaded = 0; // this is a pointer to the data loaded from a file
int datatype; // these are defined by load_image_wrapper?
V3DLONG * in_zz = 0;
unsigned char* data1d_image = p4DImage->getRawData(); //this is for the data from the current window
//and this thing that defines what channel we're looking at
char c=1;
arg.type = "random";std::vector<char*> args1;
args1.push_back("/Users/brl/dump/ex_.v3draw"); arg.p = (void *) & args1; input<< arg;
arg.type = "random";std::vector<char*> args;
char channel = '0' + c;
args.push_back("3");args.push_back("3");args.push_back("3");args.push_back(&channel); args.push_back("1.0"); arg.p = (void *) & args; input << arg;
arg.type = "random";std::vector<char*> args2;args2.push_back("/Users/brl/dump/gfImage.v3draw"); arg.p = (void *) & args2; output<< arg;
QString full_plugin_name = "gaussian";
QString func_name = "gf";
callback.callPluginFunc(full_plugin_name,func_name, input,output);
char * outimg_file = ((vector<char*> *)(output.at(0).p))->at(0);
v3d_msg(outimg_file);
simple_loadimage_wrapper(callback, outimg_file, data1d_loaded, in_zz, datatype);
// remove("temp.v3draw");
// remove("gfImage.v3draw");
}
else if (menu_name == tr("Modify voxels"))
{
// this will be my processImage function which will be defined below
processImage(callback);
}
else
{
v3d_msg(tr("BRL test plugin 00 "
"Developed by BRL 2013.12.20"));
}
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:66,代码来源:BRL00_plugin.cpp
示例19: domenu
void GVFplugin::domenu(const QString &menu_name, V3DPluginCallback2 &callback, QWidget *parent)
{
if (menu_name == tr("Gradient vector flow based Segmentation"))
{
// the GVF function wants a pointer to a Vol3DSimple, which I haven't seen before.
// this code below generates it (take from plugin_FL_cellseg)
// check what's up with the current window: is there a valid image pointer?
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
v3d_msg("Please open an image.");
return;
}
Image4DSimple* subject = callback.getImage(curwin);
QString m_InputFileName = callback.getImageName(curwin);
if (!subject)
{
QMessageBox::information(0, "", QObject::tr("No image is open."));
return;
}
if (subject->getDatatype()!=V3D_UINT8)
{
QMessageBox::information(0, "", QObject::tr("This demo program only supports 8-bit data. Your current image data type is not supported."));
return;
}
V3DLONG sz0 = subject->getXDim();
V3DLONG sz1 = subject->getYDim();
V3DLONG sz2 = subject->getZDim();
V3DLONG sz3 = subject->getCDim();
Image4DProxy<Image4DSimple> pSub(subject);
V3DLONG channelsz = sz0*sz1*sz2;
float *pLabel = 0;
unsigned char *pData = 0;
gvfsegPara segpara; // set these fields one at a time:
segpara.diffusionIteration= 5;
segpara.fusionThreshold = 10;
segpara.minRegion = 10;
segpara.sigma = 3; // doesn't seem to be used in the actual function?
//input parameters
bool ok1;
int c=1;
if (sz3>1) //only need to ask if more than one channel
{
c = QInputDialog::getInteger(parent, "Channel",
"Choose channel for segmentation:",
1, 1, sz3, 1, &ok1);
c = c-1; //channels are indexed to 0 in Image4DSimple->getRawDataAtChannel
if (!ok1)
return;
}
// read in parameters
segpara.diffusionIteration = QInputDialog::getInteger(parent, "Diffusion Iterations",
"Choose Number of Diffusion Iterations:",
5, 1, 10, 1, &ok1);
if (!ok1)
return;
segpara.fusionThreshold = QInputDialog::getInteger(parent, "Fusion Threshold",
"Choose Fusion Threshold :",
2, 1, 10, 1, &ok1);
if (!ok1)
return;
segpara.minRegion= QInputDialog::getInteger(parent, "Minimum Region",
"Choose Minimum Region Size (voxels):",
10, 1, 1000, 1, &ok1);
if (!ok1)
return;
// allocate memory for the images
Vol3DSimple <unsigned char> * tmp_inimg = 0;
Vol3DSimple <USHORTINT16> * tmp_outimg = 0;
try
{
tmp_inimg = new Vol3DSimple <unsigned char> (sz0, sz1, sz2);
//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:101,代码来源:GVFplugin_plugin.cpp
示例20: reconstruction_func
void reconstruction_func(V3DPluginCallback2 &callback, QWidget *parent, input_PARA &PARA, bool bmenu)
{
unsigned char* data1d = 0;
V3DLONG N,M,P,sc,c;
V3DLONG in_sz[4];
if(bmenu)
{
v3dhandle curwin = callback.currentImageWindow();
if (!curwin)
{
QMessageBox::information(0, "", "You don't have any image open in the main window.");
return;
}
Image4DSimple* p4DImage = callback.getImage(curwin);
if (!p4DImage)
{
QMessageBox::information(0, "", "The image pointer is invalid. Ensure your data is valid and try again!");
return;
}
data1d = p4DImage->getRawData();
N = p4DImage->getXDim();
M = p4DImage->getYDim();
P = p4DImage->getZDim();
sc = p4DImage->getCDim();
bool ok1;
if(sc==1)
{
c=1;
ok1=true;
}
else
{
c = QInputDialog::getInteger(parent, "Channel",
"Enter channel NO:",
1, 1, sc, 1, &ok1);
}
if(!ok1)
return;
in_sz[0] = N;
in_sz[1] = M;
in_sz[2] = P;
in_sz[3] = sc;
PARA.inimg_file = p4DImage->getFileName();
}
else
{
int datatype = 0;
if (!simple_loadimage_wrapper(callback,PARA.inimg_file.toStdString().c_str(), data1d, in_sz, datatype))
{
fprintf (stderr, "Error happens in reading the subject file [%s]. Exit. \n",PARA.inimg_file.toStdString().c_str());
return;
}
if(PARA.channel < 1 || PARA.channel > in_sz[3])
{
fprintf (stderr, "Invalid channel number. \n");
return;
}
N = in_sz[0];
M = in_sz[1];
P = in_sz[2];
sc = in_sz[3];
c = PARA.channel;
}
//main neuron reconstruction code
//Stack *data1d_ch1 = C_Stack::make(GREY,(int)N,(int)M,(int)P);
V3DLONG pagesz = N*M*P;
V3DLONG offsetc = (c-1)*pagesz;
size_t voxelNumber = ((size_t) N) * M * P;
float *im3d = new float[voxelNumber];
size_t voxelOffset = 0;
float maxI = -FLT_MAX;
float minI = FLT_MAX;
for(V3DLONG z = 0; z < P; z++)
{
V3DLONG offsetk = z*M*N;
for(V3DLONG y = 0; y < M; y++)
{
V3DLONG offsetj = y*N;
for(V3DLONG x = 0; x < N; x++)
{
voxelOffset = offsetk + offsetj + x;
float dataval = data1d[offsetc + voxelOffset];
if (maxI < dataval) {
maxI = dataval;
}
//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:101,代码来源:neutu_autotrace_plugin.cpp
注:本文中的V3DPluginCallback2类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允 |
请发表评论