macros,weka,imagej , Use Weka from ImageJ macro: 'path' is required but unset


Use Weka from ImageJ macro: 'path' is required but unset

Question:

Tag: macros,weka,imagej

I have tried Calling Weka from an ImageJ(Fiji) macro:

run("Trainable Weka Segmentation", "open=C:\\input\\test.tif inputfile=C:\input\test.tif path=[Ljava.lang.String;@77e655d8");

But when I run that I get an error message: 'path' is required but unset

This line is exactly the line I get when recording a macro and opening test.tif when the Trainable Weka Segmentation dialog starts. I have also tried without the inputfile and/or path variables.

How should I call "Trainable Weka Segmentation"?


Answer:

The Trainable Weka Segmentation plugin doesn't adhere to the macro recording conventions of ImageJ, mainly because of its complex structure.

However, the correct way to interact with the plugin by macro scripting is described extensively in its documentation on the Fiji wiki. In summary, you need to something like:

open("C:\\input\\test.tif"); // open your file
run("Trainable Weka Segmentation"); // then start the plugin

call("trainableSegmentation.Weka_Segmentation.loadClassifier", "C:\\path\\to\\your\\classifier.model");

call("trainableSegmentation.Weka_Segmentation.getProbability");

Related:


Accessing argument's metadata in Clojure macro


clojure,macros
Is there a way to retrieve the metadata of the arguments inside a clojure macro without using eval? The only thing I could come up with so far is this: (def ^{:a :b} my-var) (defmacro my-macro [s] (prn (eval `(meta (var ~s))))) (my-macro my-var) ;; Prints {:a :b, :name my-var,...

Prediction in weka using explorer


weka
Once i have trained and generated a model , as of now from the examples i have seen , we are using a testing set where we have to put values for actual and predicted , is there a way where i can either put this actual column as empty...

Extract Argument from C Macro


c,macros,arguments,c-preprocessor
I have a number of definitions consisting of two comma-separated expressions, like this: #define PIN_ALARM GPIOC,14 I want to pass the second expression of those definitions (14 in the case above) to unary macros like the following: #define _PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) How can I extract the second...

Use significant attributes only, or use full set of attributes to build J48 model after checking information gain?


tree,weka,c4.5,j48
Weka's J48 allows one to check information gain on a full set of attributes, should I use those significant attributes to build my model? Or should I use the full set of attributes?

C++ / C #define macro calculation


c++,c,macros
Suppose I have #define DETUNE1 sqrt(7)-sqrt(5) #define DETUNE2 sqrt(11)-sqrt(7) And I call these multiple times in my program. Are DETUNE1 and DETUNE2 calculated every time it is called? Thanks. Please don't downvote this, I really want to know and a search didn't turn up anything definite. ...

How to share same header files between kernel modules and userspace applications.


linux-kernel,macros,linux-device-driver,header-files,ioctl
I want to implement a simple module in which an ioctl() method is used. In the kernel module, I use kernel macros, such as _IO(), _IOWR(), etc., to define my own ioctl sub-commands. In facts, I don't care the actual values of these definitions for that I will always use...

Can I create a macro that unrolls loops?


macros,rust
I'm trying to write some fast matrix code in Rust and to do this needs to ensure that loops are unrolled. Is there a way to create a compile-time for-loop? E.g: I want unroll_loop!(f, a, 3); to generate f(a, 0); f(a, 1); f(a, 2); ...

Split string in macro


c++,string,split,macros
I've a class name with its namespace, like BasicType::MyType. It's possible to create a macro that split the name and uses only the part after the scope operator (I want to create a MyType object in macro without the first part)? EDIT: I'm using a library with different classes in...

clojure quoting inside let


clojure,macros,eval
Quoting (both syntax and non-syntax) seems to fail to detect vars inside a let statement: (let [foo 1] (eval `(print foo))) This will generate an error or use whatever prior value bound was bound to foo in (def foo bar). Is there a way to make the syntax quote use...

Error trying to call .buildClassifier (Weka) in Java AndroidStudio


java,android,android-studio,weka
I am trying to use Weka in Android Studio. And I am stuck at the this line: linearRegresion.buildClassifier(data); Its red underlined and it says: Unhandled Exception:Java.lang.Exception I was trying other ways and with different dataSet and its allways underlined at .buildClassifier //test: NaiveBayes nB = new NaiveBayes(); nB.buildClassifier(dataSet); //Unhandled exception...

Backquote String Interpolation


macros,lisp,common-lisp
Is it possible to use lisp's macro to do string interpolation? For instance, can I make a macro like this: (defmacro test (a) `",a") So that (test abc) returns "abc" as a string? I could probably cheat by quoting it and turning that quote into a string, but that doesn't...

Read input into string in Lisp reader macro


macros,common-lisp,reader-macro
I am trying to make a reader macro that would convert @this into "this". This is what I currently have: (defun string-reader (stream char) (declare (ignore char)) (format nil "\"~a\"" (read-line stream t nil t)) ) (set-macro-character #\@ #'string-reader ) The problem is that this requires that I put a...

ARFF file extension to csv binary executable


bash,csv,weka,file-conversion,arff
Thanks in advance for the help. I'm looking for a binary executable to convert an .arff into a .csv in a bash script. Ideally something that I could run along the lines of #! /bin/sh ... some stuff.... converstionFunc input.arff output.csv ... some more stuff ... Looking into writing this...

x-macro conditional error - number comparison


c,macros,x-macros
I would like to generate compile time error for X-macro for all X(a, b) where a > b /* X(a, b) */ #define LIST \ X(10, 20) \ X(5, 20) \ X(30, 20) \ X(1, 20) So, generate error for X(30, 20) Is this possible in C? EDIT: example usage...

Can I manually create an RWeka decision (Recursive Partitioning) tree?


r,weka,decision-tree
I have constructed a J48 decision tree using RWeka. I would like to compare its performance to a decision tree described an existing (externally computed) decision tree. I'm new to RWeka and I'm having trouble manually creating an RWeka decision tree. Ideally, I would like to show the two side-by-side...

Weka in Java - How to get predictions for IBk or KStar or LWL or


java,weka,predict
I've searched all over stackoverflow and google for these kind predicitons but found nothing for IBk or KStar or LWL. I would need one instance predictions from any of these three clasifiers.I am doing this in Android studio. I've found ways of getting predictions from other classifiers like these: for...

How does this code print odd and even?


c,if-statement,macros,logic
#define MACRO(num, str) {\ printf("%d", num);\ printf(" is");\ printf(" %s number", str);\ printf("\n");\ } int main(void) { int num; printf("Enter a number: "); scanf("%d", &num); if (num & 1) { MACRO(num, "Odd"); } else { MACRO(num, "Even"); } return 0; } Please explain the above code (if/else condition and how...

scatter plot for a multiclass dataset with class imbalance and class overlapping


r,classification,weka,scatter-plot
I'm using Weka to develop a classifier for detecting semantic relations. Lets supose I have a multiclass dataset. The dataset, at first, contains 4 numeric features (could be over 4) and a class attribute, where a valid class attribute value is "HYPERNYM", "SYNONYM" or "NO", i.e., three classes. So, examples...

Is there any way to skip macro replacement(During preprocessing) when macro is used as a variable name?


c++,qt,c++11,macros,qt5
ConflictHeader.h #define _c 6 //This is third party header, canot change, since // there is no sorce code to rebuild testclass.h #ifndef TESTCLASS_H #define TESTCLASS_H #include <QObject> #include "ConflictHeader.h"//Include conflicted header class TestClass : public QObject { Q_OBJECT public: TestClass(QObject *parent); ~TestClass(); private: }; #endif // TESTCLASS_H testclass.cpp #include "testclass.h"...

Defining Macros that are equal to functions that return objects in C++


c++,static,macros,singleton
So I have the singleton pattern working the way I want to, I think the main problem is something with pointers and refrences. ("..." represents irrelevent code). Universe.h ... #define TheUniverse Universe::GetInstance (); ... public: static Universe& GetInstance (); ... private: static Universe* x_instance; ... Universe.cpp ... Universe* Universe::x_instance =...

Combining multiple template classes to one class using typedef


c++,templates,macros,typedef
I have the following piece of code. Let us have the function declaration and implementation seperate. #include <iostream> class Y1 {}; class Y2 {}; template <class T1, class T2> class A { public: explicit A(); void foo() const; int bar() const; }; template <class T1, class T2> A<T1, T2>::A() {}...

Writing a `define-let` macro, with hygiene


macros,racket,define-syntax,hygiene
I'm trying to write a define-let macro in racket, which "saves" the header of a (let ((var value) ...) ...) , namely just the (var value) ... part, and allows re-using it later on. The code below works as expected: #lang racket ;; define-let allows saving the header part of...

Append the string provided by __FUNCTION__ macro


c++,macros
I have defined a macro as following: #define ADD_TIME_ENTRY(_name_) m_pTimeMeasurement->addTimeEntry(_name_); Now, I want to pass the function name through ADD_TIME_ENTRY() in whichsoever function I put ADD_TIME_ENTRY() ADD_TIME_ENTRY(__FUNCTION__) works fine for me but now, I want to add "_start" or "_stop" at the end of the function name. I mean, I...

Providing new version of existing macro with parameters


c++,macros,overloading
We have an existing log macro in our code. Lets call it LOG_XXX where XXX is the log level to use, such as LOG_INFO, LOG_DEBUG, LOG_ERROR etc. We stream log messages to the macro: LOG_INFO << "This is a log message."; Under the covers, the macro creates a temporary object...

defining recursive values C


c,macros
#define BLOCK_OFFSET(block) (BASE_OFFSET+(block-1)*block_size) usage lseek(fd, BLOCK_OFFSET(group->bg_inode_table)+(inode_no-1)*sizeof(struct ext2_inode),SEEK_SET); This is a fragment of a code im trying to understand and I have no idea how that definition works. Is it recursive? Can someone explain step by step whats happening in that lseek?...

Why is it not advised to define macros in header files?


c++,macros,preprocessor
The Google C++ Style Guide guide advises that macros must not be defined in a .h (header) file. What are the cons of doing it?

how to apply macro on list of lines with vim


linux,vim,macros
let's suppose I want to apply a macro stored on register 1 on lines: 2, 5, 9 but without applying on lines in between. I saw that you can give a range but that is not what I want. I've tried some variation on :2, 5, 9 @1 without success

Why don't I get a warning when I declare a variable with same name in a macro that already exists in a function?


c,macros,ansi
Playing with a macro and thought about the following scenario. Declaring variable in a macro which already exists in function from which this macro has been called, why compiler doesn't complain. When I declare in a code a variable it give me a warning: Redefinition of 'temp' I think that...

Why is my C code printing out an extra line of rows?


c,loops,for-loop,macros,printf
#include <stdio.h> #define rows 500 //can define rows as any number int main() { int i,j; for(i=0;i<=rows;++i) { for(j=0;j<(2*i+1);++j) { printf("* "); } printf("\n"); } return 0; } So here is my code, what it does is it prints the number of rows set by #define and creates a right...

how to programmatically create ensembles in weka?


java,machine-learning,weka
Does there already exist a class in weka that takes care of voting/averaging different models, or do I have to come up with my own scheme? I already looked for that kind of functionality on the web, but I couldn't find any specific information....

Macro to push arguments onto stack


visual-c++,assembly,macros
I've been working on a fun little project to mess around with how functions are called and I need a macro to push arguments as it'll be quite time consuming to push the arguments manually for every instance of this obfuscated call. This is my code so far: #define pushargs(...)...

Why do I have to expose a macro implementation's 'use' in the client library?


macros,rust
I'm trying to use a macro I've created in a separate module. With reference to this SO question, I've imported a macro fine. However it seems that I have Update to add macro implementation lib.rs #![macro_use] use std::fmt; use std::ffi::CString; use std::ffi::CStr; use std::str; extern crate libc; pub enum DbaxError...

What does the non-terminating-p argument of set-macro-character do?


macros,common-lisp
Set-macro-character has an optional argument called non-terminating-p. It seems to be used to indicate whether another character should be read after reading the macro character, but the reader algorithm seems to ignore this argument. Is there a difference whether I set it to true or false?

How to control C Macro Precedence


c,macros
#define VAL1CHK 20 #define NUM 1 #define JOIN(A,B,C) A##B##C int x = JOIN(VAL,NUM,CHK); With above code my expectation was int x = 20; But i get compilation error as macro expands to int x = VALNUMCHK; // Which is undefined How to make it so that NUM is replaced first...

How to test whether an identifier that is accessible only through a #define macro is defined?


c++,c,macros
I have a #define mapping an identifier (a function name) to a new name like this: #define A doStuff This part I cannot do anything about, I have to access "A" since the actual identifier (doStuff here) may change (and this is not under my control). Now the referenced symbol...

Use Weka from ImageJ macro: 'path' is required but unset


macros,weka,imagej
I have tried Calling Weka from an ImageJ(Fiji) macro: run("Trainable Weka Segmentation", "open=C:\\input\\test.tif inputfile=C:\input\test.tif path=[Ljava.lang.String;@77e655d8"); But when I run that I get an error message: 'path' is required but unset This line is exactly the line I get when recording a macro and opening test.tif when the Trainable Weka Segmentation...

syntax error : missing ')' before 'constant'


c,compiler-errors,macros,syntax-error,c-preprocessor
I have some syntax problems that I don't know how to fix. I'm trying to build some functions to matrix, can someone help me resolve those problems? 1>c:\documents and settings\one\my documents\visual studio 2010\projects\hw3\hw3\q2.c(11): error C2143: syntax error : missing ')' before 'constant' 1>c:\documents and settings\one\my documents\visual studio 2010\projects\hw3\hw3\q2.c(11): error C2143:...

Understanding NASM Macro


assembly,macros,ffmpeg,nasm
I've come around this macro in a assembly source file and I just can't figure out how it's working. So first I come around this function (hevc_deblock.h): cglobal hevc_v_loop_filter_chroma_8, 3, 5, 7, pix, stride, tc, pix0, r3stride sub pixq, 2 lea r3strideq, [3*strideq] mov pix0q, pixq add pixq, r3strideq TRANSPOSE4x8B_LOAD...

Chained CostSensitiveClassifier


classification,weka
By mistake, I was using a CostSensitiveAnalysis inside other, each with different weight matrices. One was (matrix 1a) 0 3 1 0 The other was (matrix 1b) 0 1 3 0 And was getting really good results. When I found out the mistake, I changed my weight matrix to: (matrix...

Can I create a macro or shortuct for a step of XPath in XQuery?


xml,xpath,macros,xquery
Do we have Macros in XQuery? If yes, could you please give an example of their usage. I have the following code let $x := //price/ancestor::* Can I someway, using macros or other things write it as follows: let $x := //price/outward So, the outward should mean ancestor::*...

Creating a function in compile time using a bitmap like macro


c,macros
I have an ansi C function to sum up values from an array, based on patterns. Something like: long sum_all_according_to_pattern(int n, int *values, int *pattern) { long sum = 0; int i = 0; for(;i<n;i++){ if(pattern[i]) sum+=values[i]; } return sum; } Let's say I've a set of patterns such as:...

How to identifying the exact instances that are wrongly classified in weka


weka,text-classification
Here is my code, I'm using weka API. I want to printout wrongly classified instances and instances that are classified accurately. please help me, or tell me about any other text classification java API which is capable of doing what I want. public void evaluation() throws Exception{ BufferedReader reader=null; reader=...

Replace numbers with Boolean in r


r,csv,replace,weka
I want to use weka to predict future instances. I have a csv file and a small portion of it is as following: I used r to read the file but I am not sure how to substitute the zeros with "No error" and anything besides zero to "Error". I...

Julia: How do I create a macro that returns its argument?


macros,julia-lang
My question is quite similar to this one, but with a difference. I want to create a macro (or whatever) that behaves this way: julia> @my-macro x + 2 :(x + 2) (note that x + 2 is not enclosed in quotes). Is there something like that in Julia? And...

create a macro in sas


macros,sas
I have a report that is generated once a year. each report has the form of the year inside the name - report-2011.xls, report-2012.xls etc. each report contains the following vars: ID, SAL=average monthly salary of that year, Gender (0=male, 1=female), Married (0=not married, 1=married), I need to create a...

how to get k nearest neighbors using weka kdtree


java,nullpointerexception,weka,nearest-neighbor
I'm trying to get k nearest neighbors using weka KDTree implementation like this: ArrayList<ArrayList<Double>> ar = new ArrayList<ArrayList<Double>>(); ArrayList<Double> d1 = new ArrayList<Double>(); d1.add(1.1); d1.add(1.1); ArrayList<Double> d2 = new ArrayList<Double>(); d2.add(2.2); d2.add(2.2); ArrayList<Double> d3 = new ArrayList<Double>(); d3.add(3.3); d3.add(3.3); ar.add(d1); ar.add(d2); ar.add(d3); Attribute a1 = new Attribute("attr1", 0); Attribute a2...

Parentheses and macro overloading in C++


c++,macros
My codebase has an existing macro: #define SOME_MACRO <macro definition> For some changes I'm making, I want to add a new version of the macro that takes an argument. #define SOME_MACRO(arg1) <macro definition> I see that this question addresses selecting from multiple argument versions of a macro. However, the SOME_MACRO...

SAS Concatenate Multiple Variables to Create Data-Driven Macro Statements


sql,macros,sas,append,concatenation
In order to keep my process data-driven, I'm trying to concatenate multiple variables, separated by comma, in order to ultimately put them in a PROC SQL list to call in multiple macro statements that would otherwise clutter my SAS pogram. Take the following sample dataset: DATA TEST; INPUT YEAR CONDITION...

Unexpected output printf statement [duplicate]


c,macros,printf,ternary-operator
This question already has an answer here: Why is ā€œiā€ variable getting incremented twice in my program? 8 answers Why outputs of i and j in the following two printf()s are different? #include <cstdio> #define MAX(x,y) (x)>(y)?(x):(y) int main() { int i=10,j=5,k=0; k==MAX(i++,++j); printf("%d %d %d\n",i,j,k); i=10,j=5,k=0; k=MAX(i++,++j); printf("%d...