export on CSV - data format of Roi

52 views
Skip to first unread message

MLB

unread,
Mar 18, 2015, 1:44:35 PM3/18/15
to icy-so...@googlegroups.com
Hello,

I have two questions :

In a script, I use
 XLSUtil.setCellNumber(xlsPage, 0, numligne , t)
to export data.

Is it possible to save on CSV ?

I extract data from ROI

                         min =  ROIUtil.getMinIntensity(seqvert, roi, -1, t, -1)
                         mean = ROIUtil.getMeanIntensity(seqvert, roi, -1, t, -1)
                         max =  ROIUtil.getMaxIntensity(seqvert, roi, -1, t, -1)
                         area = ROIUtil.getNumPixel(seqvert, roi, -1 , t, -1)
                         mcenter = ROIUtil.getMassCenter(roi)
                         mxc = mcenter.getX();
                         myc = mcenter.getY();

         and export it to xls        
XLSUtil.setCellNumber(xlsPage, 7, numligne , t)
                  XLSUtil.setCellString(xlsPage, 8, numligne , roi.getName())
                  XLSUtil.setCellNumber(xlsPage, 9, numligne , area)
                  XLSUtil.setCellNumber(xlsPage, 10, numligne , min)
                  XLSUtil.setCellNumber(xlsPage, 11, numligne , mean)
                  XLSUtil.setCellNumber(xlsPage, 12, numligne , max)
                  XLSUtil.setCellString(xlsPage, 13, numligne , seqhor.getFilename())
                  XLSUtil.setCellString(xlsPage, 14, numligne , mcenter)
                  XLSUtil.setCellString(xlsPage, 15, numligne , mxc)
                  XLSUtil.setCellString(xlsPage, 16, numligne , myc)
Saisissez le code ici...


And ... they have different formats
first are  00,00
and the two last are like it 00.00


Is it possible to standardize format into the script ?

Thank you for your help,

Marie Laure

Stephane

unread,
Mar 19, 2015, 5:14:09 AM3/19/15
to icy-so...@googlegroups.com
Hi Marie-Laure,

You used XLSUtil.setCellString(..) for the last 2 values instead of XLSUtil.setCellNumber(..) method, that explains the different number format. For the CSV export, you can't do it directly, the solution is to build it yourself (not difficult) or do it from Excel.

Best,

- Stephane

MLB

unread,
Mar 19, 2015, 9:14:38 AM3/19/15
to icy-so...@googlegroups.com
Hi Stephane,
Thank you verymuch  for your help,


fichTXT=sequence.getFilename()+"-RES.csv";    
fw
= new FileWriter(fichTXT, false) // replace by true to append the file if it exists
// data title
fw
.write("vert T position"+","+"vert ROI name"+","+"vert area (px)"+","+"vert Min intensity"+","+"vert Mean intensity"+","+"vert Max intensity"+","+"vert File Name"+","+"hor T position"+","+"hor ROI name"+","+"hor area (px)"+","+"hor Min intensity"+","+"hor Mean intensity"+","+"hor Max intensity"+","+"hor File Name"+","+"Mcenter X"+","+"Mcenter Y"+"\n");
//data value on a loop
fw
.write(t+","+name+","+area+","+min+","+mean+","+max+","+"FnameV"+","+t+","+name+","+area+","+min+","+mean+","+max+","+"FnameH"+","+mxc+","+myc+"\n");

fw
.flush() // make sure everything is sent to the file
fw
.close() // close the file properly




Marie Laure

Stephane

unread,
Mar 23, 2015, 4:45:29 AM3/23/15
to icy-so...@googlegroups.com
Well done for the CSV export Marie-Laure !
Reply all
Reply to author
Forward
0 new messages