\hypertarget{group__gPlugin}{
\subsection{Classes related to the ImageJ Plugin}
\label{group__gPlugin}\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
}
\subsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{classClassicGlow}{ClassicGlow}
\begin{DoxyCompactList}\small\item\em Plugin implementing the classic glow/hot LUT which seems to be missing from ImageJ. \end{DoxyCompactList}\item 
class \hyperlink{classLoadTestData}{LoadTestData}
\begin{DoxyCompactList}\small\item\em Plugin class to load the standard test data from the JAR file. \end{DoxyCompactList}\item 
class \hyperlink{classJNIUserInterface}{JNIUserInterface}
\begin{DoxyCompactList}\small\item\em 3B User interface for the Java plugin. \end{DoxyCompactList}\item 
class \hyperlink{classSPair}{SPair}
\begin{DoxyCompactList}\small\item\em Utility class to hold a pair of strings. \end{DoxyCompactList}\item 
class \hyperlink{classUtil}{Util}
\begin{DoxyCompactList}\small\item\em Utility calss to hold a number of handy static functions. \end{DoxyCompactList}\item 
class \hyperlink{classthree__B}{three\_\-B}
\begin{DoxyCompactList}\small\item\em ImageJ plugin class. \end{DoxyCompactList}\item 
class \hyperlink{classAdvancedDialog}{AdvancedDialog}
\begin{DoxyCompactList}\small\item\em Control panel which basically presents the .cfg file in a large edit box along with additional necessary things (frame range and pixel size). \end{DoxyCompactList}\item 
class \hyperlink{classThreeBDialog}{ThreeBDialog}
\begin{DoxyCompactList}\small\item\em Dialog box for starting 3B The dialog highlights bad things in red. \end{DoxyCompactList}\item 
class \hyperlink{classSpot}{Spot}
\begin{DoxyCompactList}\small\item\em Basic spot class, simply contains coordinates. \end{DoxyCompactList}\item 
class \hyperlink{classSomethingChanges}{SomethingChanges}
\begin{DoxyCompactList}\small\item\em Listener class which triggers a complete redraw. \end{DoxyCompactList}\item 
class \hyperlink{classFloatSliderWithBox}{FloatSliderWithBox}
\begin{DoxyCompactList}\small\item\em This class makes a floating point slider bar with an edit box next to it for more precision. \end{DoxyCompactList}\item 
class \hyperlink{classCloseButtonListener}{CloseButtonListener}
\begin{DoxyCompactList}\small\item\em Close button issues a window close event. \end{DoxyCompactList}\item 
class \hyperlink{classStopButtonListener}{StopButtonListener}
\begin{DoxyCompactList}\small\item\em Stop 3B thread. \end{DoxyCompactList}\item 
class \hyperlink{classExportButtonListener}{ExportButtonListener}
\begin{DoxyCompactList}\small\item\em Listener for the export button. \end{DoxyCompactList}\item 
class \hyperlink{classEControlPanel}{EControlPanel}
\begin{DoxyCompactList}\small\item\em Control panel for running 3B plugin and providing interactive update. \end{DoxyCompactList}\item 
class \hyperlink{classThreeBRunner}{ThreeBRunner}
\begin{DoxyCompactList}\small\item\em This class deals with running the actual 3B code It should be run in a separate thread It will make calls back to a viewer, and accepts termination calls as well. \end{DoxyCompactList}\item 
class \hyperlink{classThreeBHelp}{ThreeBHelp}
\begin{DoxyCompactList}\small\item\em 3B plugin cclass to bring up a basic help window. \end{DoxyCompactList}\item 
class \hyperlink{classThreeBLoader}{ThreeBLoader}
\begin{DoxyCompactList}\small\item\em Plugin class to load up an old 3B run. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
string \hyperlink{group__gPlugin_ga997677472ec415f1c4c69beca29c163d}{get\_\-string} (JNIEnv $\ast$env, jstring js)
\item 
Image$<$ jbyte $>$ \hyperlink{group__gPlugin_gac533058e6405e3a8db2c34a497e4ed8f}{get\_\-local\_\-copy\_\-of\_\-image} (JNIEnv $\ast$env, jbyteArray data, int rows, int cols)
\item 
Image$<$ float $>$ \hyperlink{group__gPlugin_ga3a34656df1e76f4a500e5f1bfdfce82b}{get\_\-local\_\-copy\_\-of\_\-image} (JNIEnv $\ast$env, jfloatArray data, int rows, int cols)
\item 
JNIEXPORT void JNICALL \hyperlink{group__gPlugin_ga8bfd67462e743afb346dfdf85d069fcf}{Java\_\-ThreeBRunner\_\-call} (JNIEnv $\ast$env, jobject jthis, jstring cfg, jobjectArray images, jbyteArray mask\_\-data, jint n\_\-images, jint rows, jint cols, jstring file)
\item 
static \hyperlink{classSPair}{SPair} \hyperlink{group__gPlugin_gaba7626a51248fda5b1c66b7abf7b105e}{Util::getFileName} (String t)
\end{DoxyCompactItemize}


\subsubsection{Function Documentation}
\hypertarget{group__gPlugin_ga997677472ec415f1c4c69beca29c163d}{
\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}!get\_\-string@{get\_\-string}}
\index{get\_\-string@{get\_\-string}!Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
\paragraph[{get\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}string get\_\-string (
\begin{DoxyParamCaption}
\item[{JNIEnv $\ast$}]{env, }
\item[{jstring}]{js}
\end{DoxyParamCaption}
)}}
\label{group__gPlugin_ga997677472ec415f1c4c69beca29c163d}


Get a local C++ copy of a java string. 



Definition at line 141 of file multispot5\_\-jni.cc.



Referenced by Java\_\-ThreeBRunner\_\-call().


\begin{DoxyCode}
{
    const char* str;

    //Covert the config into a string
    str = env->GetStringUTFChars(js, NULL);

    string stdstring(str);
    env->ReleaseStringUTFChars(js, str);


    return stdstring;
}
\end{DoxyCode}
\hypertarget{group__gPlugin_gac533058e6405e3a8db2c34a497e4ed8f}{
\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}!get\_\-local\_\-copy\_\-of\_\-image@{get\_\-local\_\-copy\_\-of\_\-image}}
\index{get\_\-local\_\-copy\_\-of\_\-image@{get\_\-local\_\-copy\_\-of\_\-image}!Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
\paragraph[{get\_\-local\_\-copy\_\-of\_\-image}]{\setlength{\rightskip}{0pt plus 5cm}Image$<$jbyte$>$ get\_\-local\_\-copy\_\-of\_\-image (
\begin{DoxyParamCaption}
\item[{JNIEnv $\ast$}]{env, }
\item[{jbyteArray}]{data, }
\item[{int}]{rows, }
\item[{int}]{cols}
\end{DoxyParamCaption}
)}}
\label{group__gPlugin_gac533058e6405e3a8db2c34a497e4ed8f}


Get a local C++ copy of an image from a jbyteArray coming from the guts of ImageJ. 



Definition at line 157 of file multispot5\_\-jni.cc.



Referenced by Java\_\-ThreeBRunner\_\-call().


\begin{DoxyCode}
{
    //This takes a copy of the pixels (perhaps)
    jbyte* pix = env->GetByteArrayElements(data, NULL);

    BasicImage<jbyte> pix_im(pix, ImageRef(cols, rows));

    Image<jbyte> im;
    im.copy_from(pix_im);
    
    //This frees the pixels if copied, or releases a reference
    env->ReleaseByteArrayElements(data,pix, JNI_ABORT);
    
    return im;
}
\end{DoxyCode}
\hypertarget{group__gPlugin_ga3a34656df1e76f4a500e5f1bfdfce82b}{
\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}!get\_\-local\_\-copy\_\-of\_\-image@{get\_\-local\_\-copy\_\-of\_\-image}}
\index{get\_\-local\_\-copy\_\-of\_\-image@{get\_\-local\_\-copy\_\-of\_\-image}!Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
\paragraph[{get\_\-local\_\-copy\_\-of\_\-image}]{\setlength{\rightskip}{0pt plus 5cm}Image$<$float$>$ get\_\-local\_\-copy\_\-of\_\-image (
\begin{DoxyParamCaption}
\item[{JNIEnv $\ast$}]{env, }
\item[{jfloatArray}]{data, }
\item[{int}]{rows, }
\item[{int}]{cols}
\end{DoxyParamCaption}
)}}
\label{group__gPlugin_ga3a34656df1e76f4a500e5f1bfdfce82b}


Get a local C++ copy of an image from a jfloatArray coming from the guts of ImageJ. 



Definition at line 175 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
{
    //This takes a copy of the pixels (perhaps)
    float* pix = env->GetFloatArrayElements(data, NULL);

    BasicImage<float> pix_im(pix, ImageRef(cols, rows));

    Image<float> im;
    im.copy_from(pix_im);
    
    //This frees the pixels if copied, or releases a reference
    env->ReleaseFloatArrayElements(data,pix, JNI_ABORT);
    
    return im;
}
\end{DoxyCode}
\hypertarget{group__gPlugin_ga8bfd67462e743afb346dfdf85d069fcf}{
\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}!Java\_\-ThreeBRunner\_\-call@{Java\_\-ThreeBRunner\_\-call}}
\index{Java\_\-ThreeBRunner\_\-call@{Java\_\-ThreeBRunner\_\-call}!Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
\paragraph[{Java\_\-ThreeBRunner\_\-call}]{\setlength{\rightskip}{0pt plus 5cm}JNIEXPORT void JNICALL Java\_\-ThreeBRunner\_\-call (
\begin{DoxyParamCaption}
\item[{JNIEnv $\ast$}]{env, }
\item[{jobject}]{jthis, }
\item[{jstring}]{cfg, }
\item[{jobjectArray}]{images, }
\item[{jbyteArray}]{mask\_\-data, }
\item[{jint}]{n\_\-images, }
\item[{jint}]{rows, }
\item[{jint}]{cols, }
\item[{jstring}]{file}
\end{DoxyParamCaption}
)}}
\label{group__gPlugin_ga8bfd67462e743afb346dfdf85d069fcf}


Run the 3B code. 



Definition at line 195 of file multispot5\_\-jni.cc.



References JNIUserInterface::fatal(), get\_\-local\_\-copy\_\-of\_\-image(), get\_\-string(), null\_\-graphics(), and JNIUserInterface::send\_\-message().


\begin{DoxyCode}
{
    istringstream config(get_string(env, cfg));
    GUI.ParseStream(config);

    JNIUserInterface ui(env, jthis);
    ui.send_message("Initializing...");
    
    string filename = get_string(env, file);

    //Attmpt to open the file
    ofstream save_spots;
    save_spots.open(filename.c_str());
    int err = errno;

    if(!save_spots.good())
    {
        ui.fatal("failed to open " + filename + ": " + strerror(err));
        return;
    }

    vector<ImageRef> maskir;
    Image<double> maskd;
    {
        Image<jbyte> mask = get_local_copy_of_image(env, mask_data, rows, cols);
        maskd = convert_image(mask);
        for(ImageRef p(-1, 0); p.next(mask.size()); )
            if(mask[p])
                maskir.push_back(p);
    }   


    vector<Image<float> > ims;

    for(int i=0; i < n_images; i++)
    {
        jfloatArray f = static_cast<jfloatArray>(env->GetObjectArrayElement(image
      s, i));
        ims.push_back(preprocess_image(get_local_copy_of_image(env, f, rows, cols
      )));
        env->DeleteLocalRef(f);
    }

    double mean, variance;
    tie(mean, variance) = mean_and_variance(ims);

    for(unsigned int i=0; i < ims.size(); i++)
            transform(ims[i].begin(), ims[i].end(), ims[i].begin(), bind1st(multi
      plies<double>(), 1/ sqrt(variance)));
     
    tie(mean, variance) = mean_and_variance(ims);

    //A sanity check.
    cerr << "Rescaled:\n";
    cerr << "mean = " << mean << endl;
    cerr << "std  = " << sqrt(variance) << endl;
    cerr << "Version 1.1" << endl;


    auto_ptr<FitSpotsGraphics> gr = null_graphics();

    place_and_fit_spots(ims, maskir, maskd, save_spots, *gr, ui);
}
\end{DoxyCode}
\hypertarget{group__gPlugin_gaba7626a51248fda5b1c66b7abf7b105e}{
\index{Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}!getFileName@{getFileName}}
\index{getFileName@{getFileName}!Classes related to the ImageJ Plugin@{Classes related to the ImageJ Plugin}}
\paragraph[{getFileName}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf SPair} Util::getFileName (
\begin{DoxyParamCaption}
\item[{String}]{t}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, static, package\mbox{]}}}}
\label{group__gPlugin_gaba7626a51248fda5b1c66b7abf7b105e}


The a file name for saving and complete path using ImageJ's file open dialog. 

Kep re-\/querying user if the file will be overwritten. Windows already provides the query built in.


\begin{DoxyParams}{Parameters}
{\em t} & Initial file name \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
filename and full path 
\end{DoxyReturn}


Definition at line 80 of file three\_\-B.java.



References SPair::a, and SPair::b.



Referenced by three\_\-B::run().


\begin{DoxyCode}
    {
        //Get a filename to save as, with appropriate warnings for 
        //overwriting files.
        String fname, fullname;
        while(true)
        {
            SaveDialog save = new SaveDialog("Save 3B output", t, ".txt");
            fname = save.getFileName();

            fullname = save.getDirectory() + File.separator + fname;

            if(fname == null)
                break;

            File test = new File(fullname);
            //Windows' open dialog seems to do overwrite confirmation automatical
      ly,
            //so there is no need to do it here.
            if(!ij.IJ.isWindows() && test.exists())
            {
                GenericDialog g = new GenericDialog("Overwrite file?");
                g.addMessage("The file \"" + fname + "\" already exists. Continue
       and overwrite?");
                g.enableYesNoCancel("Yes", "No");
                g.showDialog();

                if(g.wasOKed())
                    break;
                else if(g.wasCanceled())
                {
                    fname = null;
                    break;
                }
            }
            else
                break;
        }

        SPair r = new SPair();
        r.a = fname;
        r.b = fullname;
        return r;
    }
\end{DoxyCode}
