The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Analysis of Multiple Matrices
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sch01548

USA
Posts

Posted - 05/19/2006 :  10:14:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: Win 2000

I am analyzing images with TweakROI, but need statistics from each ROI (namely a mean and stdev). I started writing a program in OriginC, but have hit 2 snags. First, is something as simple as I cannot get Origin C to write values into the new worksheet I create. This should be no problem but I have an outdated manual and it looks like things have changed.
Second, I have about 20 ROI's per file, and would like the program to simply run over all of them. They are named sequencially, e.g. Cell1, Cell2, ect.; but I have only found methods of selecting active matrices. How would I go about looping over these?
thanks,
steve

Mike Buess

USA
3037 Posts

Posted - 05/19/2006 :  10:54:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Steve,

Questions about File Exchange addons should be addressed to their authors. In this case that's me but there is always an email link in the Review section at the bottom of each description.

I think you can do all that you want from the TweakROI toolbar. The ROI Statistics button will send min, max, mean and sd for that active window to the Results log. The Batch Statistics button will get statistics from the active matrix for all ROI matrices in the project. Those statistics are saved to a worksheet. See the TweakROI help file for details.

Use Help > Check for Updates to get the latest program patch and help files. Help files do not come with the program patches so you need to Check for Updates again for the latest help files.

Mike Buess
Origin WebRing Member
Go to Top of Page

sch01548

USA
Posts

Posted - 05/19/2006 :  11:07:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry I should have said I am not fully analyzing with TweakROI. I am using it to select individual cells. But for my stats I need to eliminate everything below threshold, and that is why I was not using the TweakROI stats. What I should have said is I have several matrices and am trying to iterate over all of them and dump 2 values into a worksheet.
cheers,
steve
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/19/2006 :  11:57:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
TweakROI statistics ignore missing values so one solution is to replace all cells in the active matrix window that have values less than threshold with missing values...

1. Select Matrix > Set Properties.
2. Set Internal Data Type to double and click OK.
3. Enter (%C)=%C<threshold ? 0/0 : %C in the script window.

If that's not enough you might find something in TweakROI.c that will help. For example, the ROI_BatchStatistics function creates a worksheet for statistical results and calls funcions to get those results.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/19/2006 12:15:12 PM
Go to Top of Page

sch01548

USA
Posts

Posted - 05/19/2006 :  12:30:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For things I want to do in other projects, as well as this one, what I really want to know is is this possible in OriginC. Mainly I need to be able to write to worksheets.
thanks,
steve
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/19/2006 :  1:29:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This function will implement the suggested changes to the active matrix window...
void test(double dThreshold)
{
MatrixLayer ml = Project.ActiveLayer();
if( !ml )
return;
ml.SetInternalData(FSI_DOUBLE); // set data type to double
Matrix mat(ml);
int nCols = mat.GetNumCols();
int nRows = mat.GetNumRows();
for(int i=0;i<nRows;i++)
{
for(int j=0;j<nCols;j++)
mat[i][j] = mat[i][j]<dThreshold ? NANUM : mat[i][j];
}
}
quote:
Mainly I need to be able to write to worksheets.
The TweakROI functions mentioned last time show how to write to worksheet.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/19/2006 1:31:29 PM

Edited by - Mike Buess on 05/19/2006 1:38:44 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000