Home Forums Imaging Export Cellspace Images to XYZ Matrix

This topic contains 5 replies, has 4 voices, and was last updated by  Ian Moffat 1 week, 5 days ago.

  • Creator
  • #7236

    Manuel Roman

    Hi all,

    Sorry to disturb again. After all my problems solved I’m getting good results with CellSpace but I was wondering If could be possible to export the data map for each wave (or element) in XYZ format, I mean, XY (coordinates) and Z (concentration).

    Thanks a lot


Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #7241

    Dr Bence Paul

    Hi Manuel,

    There is no built-in way to export x,y,z data, but below is a bit of code that you can copy and paste into a procedure window within iolite, after you have created your CellSpace image. It will create a text wave of x,y,z data for your currently displayed image. Depending on the size of your image, it may take a couple of minutes to process.

    Once it is finished, you can save the result using the Data menu -> Save Waves.

    Best regards,

    Function ExtractXYZvalues()
    	DFREF dfSav = GetDataFolderDFR()
    	SetDataFolder root:Packages:iolite:CellSpaceImages
    	Wave CellSpace_Sample
    		DoAlert 0, "Could not find the CellSpace_Sample image. Process aborted."
    	Variable NoOfRows = dimsize(CellSpace_Sample, 0)
    	Variable NoOfCols = dimsize(CellSpace_Sample, 1)
    	Make /O /T /N=(NoOfRows * NoOfCols + 1) ImageXYZ
    	ImageXYZ[0] = "x,y,z"
    	Variable RowCounter, ColCounter
    	For(RowCounter = 0; RowCounter < NoOfRows; RowCounter += 1)
    		Print "Processing Row " + num2str(RowCounter + 1)
    		For(ColCounter = 0;ColCounter < NoOfCols;ColCounter += 1)
    			ImageXYZ[RowCounter * NoOfCols + ColCounter + 1] = num2str(RowCounter) + "," + num2str(ColCounter) + "," + num2str(CellSpace_Sample[RowCounter][ColCounter])
    	Edit ImageXYZ
    	SetDataFolder dfSav

    Manuel Roman

    Many, many thanks, Vence

    It’s working great, I can export now the data to make further treatment and combine with other images…

    Thanks a lot for your help

    Best Regards



    Manuel Roman

    Sorry…my automatic corrector didn’t understand “Bence” and he wrote “Vence” instead… sorry…


    Freya George

    Hi all,
    I am trying to do exactly this, create an XY (coordinates) and Z (concentration) datafile of a range of trace elements that can be exported from the CellSpace image. However, when I copy the above code into the procedure window and execute the code, I receive a CommandError: “expected wave name, variable name, or operation.”

    Any advice on what to do? Do i first need to save the CellSpaceImage that is displayed on the screen in some way?

    Thanks a lot!

    Best regards,

    • This reply was modified 1 year, 5 months ago by  Freya George.

    Ian Moffat

    Hi Bence,
    Thanks for this very useful bit of code. Is it possible to do a similar XYZ data export if you have created an Image from Selections? If so, could you post the code please?


Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.