生物导航网博客欢迎您......


<<  < 2008 - >  >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31


公告
生物导航网博客欢迎您......

我的分类(专题)
生物导航网博客欢迎您......

日志更新
生物导航网博客欢迎您......

最新评论
生物导航网博客欢迎您......

留言板
生物导航网博客欢迎您......

链接

Blog信息
生物导航网博客欢迎您......







Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
thinker 发表于 2006-1-24 19:51:43

'**********************************************************************
' Filename:   1969_intensity_over_moving_aois.ipm
'
' Free for use as demonstration/utility code.
'
'----------------------------------------------------------------------
' PROBLEM SOLVED:
' This macro prompts for AOIs, and either propagates them through
' the stack (static AOIs) or prompts for AOI relocation on each
' frame of a sequence and sends the intensity data for each AOI
' per frame to the Output window. 
'
'----------------------------------------------------------------------
' WHO WOULD USE THIS:
'
' Anyone who wants to analyze multiple AOI's through a time lapse
' sequence.
' AOI's may remain stationary throughout the sequence or may move
' as the region of interest moves.
'
'----------------------------------------------------------------------
' SYSTEM REQUIREMENTS:
'
' Image-Pro 5.x or higher.  (Developed and tested on IPP5.0, but
' may work with v4.x.  Feedback welcome).
'
'----------------------------------------------------------------------
'HISTORY OF CHANGES:
'Macro Version:  2.0
'Created:   12.15.2003
'Modified:   12.24.2003
'Author:   Paul T. Jantzen, with the assistance of Kevin Ryan
'     and predicated on the demands of numerous dealers.
'     Supercedes Solution #553, written by:
'     Dietrich Ruehlmann, Ph.D.
'     http://members.tripod.co.uk/druehlmann/
'Application:  IPWin
'Version:   5.x+ (perhaps 4.x)
'Change History:
'  1.0: Solution #553 Created DR
'  1.0.1: 07.31.2000 DR
'    I changed a few things from the original solution 553,
'    a region analysis over a t-stack.  It now handles >1000
'    512x470 frames in reasonably good speed and coughs the
'    data into Excel (which then becomes slow).  It also
'    analyses quickly the mean data and the highest data point.
'    Pretty simple and not elegant but it does the trick.  Enjoy.
'  1.0.2: 29 November 2003 PTJ
'    Modified to provide for movement of AOIs through
'    the time sequence/stack
'  1.0.3: 05 December 2003
'    Debugged by Vern Roseman
'  1.1: 16 December 2003
'    Rewritten to incorporate coding suggestions from KR
'  2.0: 24 December 2003
'    Completed to include support for irregular AOIs, added
'    improvements from Lou Feng
'TBD:
'  Manual AOI relocation via arrow keys
'
'**********************************************************************

Sub multiple_AOIs_over_time()
 Dim arrType() As Integer
 Dim arrShape() As Variant
 Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer
 Dim AOIRect As RECT, AoiLst(0 To 3) As Integer
 Dim AOIpts() As POINTAPI, annotPts() As POINTAPI, aoiPtsPoly() As POINTAPI
 Dim aoiType As Integer, numPts As Integer
 Dim numFrames As Integer
 Dim numAOIs As Integer, MoveAOIs As Integer
 Dim ROIname As String * 25, ROItext() As String * 25, numAOIsStr2 As String
 Dim ROIpencolor As Long
 Dim ROIcolorcode As Integer

 ret = IpBlbDelete()
 Call AnnotateDelete()
 
 ret = IpOutputClear()
 DebugClear
 IpOutputShow(1)

 ret=IpSeqGet(SEQ_NUMFRAMES, numFrames) ' Get number of frames in sequence
  If numFrames = 1 Then ' If not a sequence, exit script
   ret = IpMacroStop("Not a sequence image", 0) 
   Exit Sub
  End If
  
 Begin Dialog UserDialog 400,105,"Measure intensities in ROI's" ' %GRID:10,7,1,1
  Text 10,14,290,14,"How many ROI's would you like to measure?",.Text1
  TextBox 310,7,70,21,.numAOIsStr
  OptionGroup .MoveOptions
   OptionButton 10,63,130,14,"Moving ROIs",.MoveAOIsButton
   OptionButton 10,42,130,14,"Static ROIs",.StaticROIButton
  OKButton 300,70,90,21
  CancelButton 180,70,90,21
 End Dialog
 Dim dlgInitial As UserDialog
  dlgInitial.numAOIsStr = Str(2) ' change the (2) to whatever number
  ret = Dialog(dlgInitial)  ' of AOI's are desired as a starting number
  If ret = 0 Then Exit Sub  '   not cause the error message when CANCEL button pushed
 
 MoveAOIs = dlgInitial.MoveOptions
 numAOIs = Val(dlgInitial.numAOIsStr)
 
 ReDim arrType(0 To numAOIs) As Integer
 ReDim arrShape(0 To numAOIs) As Variant
 ReDim numPolyArrPts(0 To numAOIs) As Integer
 ReDim aoiOffset(-1 To numFrames, 0 To numAOIs) As POINTAPI
 ReDim ROIText(numAOIs) As String * 25
 
 ret = IpSeqPlay(SEQ_FFRA)     'Go to the first frame

 For i=0 To numAOIs - 1
 
  ROIname = "ROI #" & (i + 1)
 
  Begin Dialog UserDialog 400,105,"Draw and name the ROI" ' %GRID:10,7,1,1
   Text 30,7,250,21,"Please draw and name ROI #" & (i + 1),.Text1
   TextBox 30,42,230,21,.ROIname
   OKButton 280,77,110,21
   CancelButton 160,77,100,21
  End Dialog
  
  Dim dlgDrawAndName As UserDialog
  dlgDrawAndName.ROIname = "ROI #" & (i + 1)
  ret = Dialog(dlgDrawAndName)
  If ret = 0 Then Exit Sub  '   not cause the error message when CANCEL button pushed

  ROItext(i) = dlgDrawAndName.ROIname
 
  ret = IpAoiGet(GETTYPE, 0, aoiType)
     arrType(i) = aoiType
  
  If aoiType = AOI_BOX Then
      ret = IpAoiGet(GETBOUNDS, 0, aoirect)
     
      aoilst(0) = aoirect.Left
      aoilst(1) = aoirect.Right
      aoilst(2) = aoirect.top
      aoilst(3) = aoirect.bottom
'      ret = IpAoiCreateBox(aoirect)
   arrShape(i) = aoiLst
   
   IpAnCreateObj(GO_OBJ_RECT) ' create annotation object representing ROI
   IpAnMove(0 , aoirect.Left , aoirect.top)
   IpAnMove(5 , aoirect.Right , aoirect.bottom)
   
   ret = IpAnCreateObj(GO_OBJ_TEXT)
   ret = IpAnMove(0, aoirect.Left, aoirect.top - 25)
   ret = IpAnSet(GO_ATTR_FONTSIZE, 28)
   ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
   ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
   ret = IpAnText(IpTrim(ROItext(i)))
   ret = IpAnMove(5, aoirect.Right, aoirect.bottom)

   
  ElseIf aoiType = AOI_ELLIPSE Then
      ret = IpAoiGet(GETBOUNDS, 0, aoirect)
      aoilst(0) = aoirect.Left
      aoilst(1) = aoirect.Right
      aoilst(2) = aoirect.top
      aoilst(3) = aoirect.bottom
'      ret = IpAoiCreateEllipse(aoirect)
   arrShape(i) = aoiLst
   
   IpAnCreateObj(GO_OBJ_ELLIPSE) ' create annotation object representing ROI
   IpAnMove(0 , aoirect.Left , aoirect.top)
   IpAnMove(5 , aoirect.Right , aoirect.bottom)
   
   ret = IpAnCreateObj(GO_OBJ_TEXT)
   ret = IpAnMove(0, aoirect.Left, aoirect.top - 25)
   ret = IpAnSet(GO_ATTR_FONTSIZE, 28)
   ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
   ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
   ret = IpAnText(IpTrim(ROItext(i)))
   ret = IpAnMove(5, aoirect.Right, aoirect.bottom)
   
  ElseIf aoiType = AOI_POLYGON Then
      ret = IpAoiGet(GETNUMPTS, 0, numPts)
      ReDim aoiPts(numPts-1)
      ret = IpAoiGet(GETPOINTS, numPts-1, aoiPts(0))
   numPolyArrPts(i) = numPts
   arrShape(i) = aoiPts
   
   ret = IpAnCreateObj(GO_OBJ_POLY) ' create annotation object representing ROI
   ret = IpAnPolyAddPtArray(aoiPts(0), numPts)
   ret = IpAnSet(GO_ATTR_CONNECT, 1)
      
   Dim PolyAOItext As RECT
   PolyAOItext.Left = aoiPts(0).x
   PolyAOItext.top = aoiPts(0).y
   PolyAOItext.Right = aoiPts(0).x + 100
   PolyAOItext.bottom = aoiPts(0).y + 100
   
   ret = IpAnCreateObj(GO_OBJ_TEXT)
   ret = IpAnMove(0, PolyAOItext.Left, PolyAOItext.top)
   ret = IpAnSet(GO_ATTR_FONTSIZE, 28)
   ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
   ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
   ret = IpAnText(IpTrim(ROItext(i)))
   ret = IpAnMove(5, PolyAOItext.Right, PolyAOItext.bottom)
   
  End If
  
 Next i
 
 ret = IpAOIShow(FRAME_NONE)
 Call AnnotateDelete()

'*****************************************************************
' moving the AOIs on subsequent frames
 If moveAOIs = 0 Then

  For k = 0 To numFrames - 1
  
   If k = 0 Then
       ret = IpSeqPlay(SEQ_FFRA) 'Go to the first frame
   Else
       ret = IpSeqPlay(SEQ_NEXT) 'Go to the next frame
   End If
     
   For i = 0 To NumAOIs - 1 'moving the AOIs
   
   aoiOffset(-1 , i).x = 0
   aoiOffset(-1 , i).y = 0
     
'    regenerate ROI from last position
    If arrType(i) = AOI_BOX Then ' AOI_BOX = 1
     aoirect.Left = arrShape(i)(0) + aoiOffset(k - 1 , i).x
     aoirect.Right = arrShape(i)(1) + aoiOffset(k - 1 , i).x
     aoirect.top = arrShape(i)(2) + aoiOffset(k - 1 , i).y
     aoirect.bottom = arrShape(i)(3)  + aoiOffset(k - 1 , i).y
     ret = IpAoiCreateBox(aoirect)
        
    ElseIf arrType(i) = AOI_ELLIPSE Then ' AOI_ELLIPSE = 3
     aoirect.Left = arrShape(i)(0) + aoiOffset(k - 1 , i).x
     aoirect.Right = arrShape(i)(1) + aoiOffset(k - 1 , i).x
     aoirect.top = arrShape(i)(2) + aoiOffset(k - 1 , i).y
     aoirect.bottom = arrShape(i)(3)  + aoiOffset(k - 1 , i).y
     ret = IpAoiCreateEllipse(aoirect)

    ElseIf arrType(i) = AOI_POLYGON Then ' AOI_POLYGON = 5
     numPts = UBound(arrShape(i)) - LBound(arrShape(i)) + 1
        ReDim aoiPts(numPts)
        aoipts = arrShape(i)
       
        For m = 0 To numPts - 1
         aoiPts(m).x = aoiPts(m).x + aoiOffset(k - 1 , i).x
         aoiPts(m).y = aoiPts(m).y + aoiOffset(k - 1 , i).y
        Next m
       
     ret = IpAoiCreateIrregular(aoiPts(0) , numPts)
     
    End If
 
    Begin Dialog UserDialog 310,77,"Move ROI" ' %GRID:10,7,1,1
     Text 20,7,280,21,"Adjust ROI#" & (i + 1) & " position for frame " & (k + 1),.Text1
     OKButton 160,42,90,21
     CancelButton 30,42,90,21
    End Dialog
    Dim dlgAOImovement As UserDialog
    ret = Dialog(dlgAOImovement)
    If ret = 0 Then Exit Sub  '   not cause the error message when CANCEL button pushed
    
    ret = IpAoiValidate() 
    
    If arrType(i) = AOI_BOX Then ' AOI_BOX = 1
        ret = IpAoiGet(GETBOUNDS, 0, aoirect)
        aoiOffset(k , i).x = aoirect.Left - arrShape(i)(0)
        aoiOffset(k , i).y = aoirect.top - arrShape(i)(2)
       
    ElseIf arrType(i) = AOI_ELLIPSE Then ' AOI_ELLIPSE = 3
        ret = IpAoiGet(GETBOUNDS, 0, aoirect)
        aoiOffset(k , i).x = aoirect.Left - arrShape(i)(0)
        aoiOffset(k , i).y = aoirect.top - arrShape(i)(2)
       
    ElseIf arrType(i) = AOI_POLYGON Then ' AOI_POLYGON = 5
        ret = IpAoiGet(GETNUMPTS, 0, numPts)
        ReDim aoiPts(numPts - 1)
        ret = IpAoiGet(GETPOINTS, numPts - 1, aoiPts(0))

     aoiOffset(k , i).x = aoiPts(0).x - arrShape(i)(0).x
        aoiOffset(k , i).y = aoiPts(0).y - arrShape(i)(0).y
    
    End If
   Next i
  Next k
 End If

'*****************************************************************
'drawing AOIs and getting intensity measurements from within each
'outputting data to output window

   Dim tb As String
   tb = Chr$(9)
   ret = IpOutput("Mean intensity :")
   Debug.Print
   Debug.Print
   ret = IpOutput("Frame #")

   For i = 0 To numAOIs - 1
      ret = IpOutput(tb & tb & iPTrim(ROItext(i)))
   Next i
   Debug.Print
   Debug.Print

    ret = IpSeqPlay(SEQ_FFRA)     'Go to the first frame
 For k = 0 To numFrames - 1
      
    ret = IpOutput("  " & Str$((k + 1)) & tb & tb)

  For i = 0 To numAOIs - 1
  ROIcolorcode = i-6*Int(i/6)+1
  ROIpencolor = Choose(ROIcolorcode, 255, 65535, 65280, 16711935, 16776960, 16711680)
   Select Case arrType(i)
    Case AOI_BOX
        aoirect.Left = arrShape(i)(0) + aoiOffset(k, i).x
        aoirect.Right = arrShape(i)(1)  + aoiOffset(k, i).x
        aoirect.top = arrShape(i)(2) + aoiOffset(k, i).y
        aoirect.bottom = arrShape(i)(3) + aoiOffset(k, i).y
     ret = IpAoiCreateBox(aoirect)
     
     IpAnCreateObj(GO_OBJ_RECT) ' create annotation object representing AOI
     IpAnMove(0 , aoirect.Left , aoirect.top)
     IpAnMove(5 , aoirect.Right , aoirect.bottom)
     ret = IpAnSet(GO_ATTR_PENCOLOR, ROIpencolor)
     IpAnSet(GO_ATTR_PENSTYLE, i)
     
     ret = IpAnCreateObj(GO_OBJ_TEXT)
     ret = IpAnMove(0, aoirect.Left, aoirect.top - 25)
     ret = IpAnSet(GO_ATTR_FONTSIZE, 16)
     ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
     ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
     ret = IpAnText(IpTrim(ROItext(i)))
     ret = IpAnMove(5, aoirect.Right, aoirect.bottom)
      
    Case AOI_ELLIPSE
        aoirect.Left = arrShape(i)(0) + aoiOffset(k, i).x
        aoirect.Right = arrShape(i)(1)  + aoiOffset(k, i).x
        aoirect.top = arrShape(i)(2) + aoiOffset(k, i).y
        aoirect.bottom = arrShape(i)(3) + aoiOffset(k, i).y
     ret = IpAoiCreateEllipse(aoirect)
     
     IpAnCreateObj(GO_OBJ_ELLIPSE) ' create annotation object representing AOI
     IpAnMove(0 , aoirect.Left , aoirect.top)
     IpAnMove(5 , aoirect.Right , aoirect.bottom)
     ret = IpAnSet(GO_ATTR_PENCOLOR, ROIpencolor)
     IpAnSet(GO_ATTR_PENSTYLE, i)
     
     ret = IpAnCreateObj(GO_OBJ_TEXT)
     ret = IpAnMove(0, aoirect.Left, aoirect.top - 25)
     ret = IpAnSet(GO_ATTR_FONTSIZE, 16)
     ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
     ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
     ret = IpAnText(IpTrim(ROItext(i)))
     ret = IpAnMove(5, aoirect.Right, aoirect.bottom)
 
    Case AOI_POLYGON
     numPts = UBound(arrShape(i)) - LBound(arrShape(i)) + 1
        ReDim aoiPts(numPts)
        aoipts = arrShape(i)
               
        For m = 0 To numPts - 1
         aoiPts(m).x = aoiPts(m).x + aoiOffset(k , i).x
         aoiPts(m).y = aoiPts(m).y + aoiOffset(k , i).y
        Next m
        
     ret = IpAoiCreateIrregular(aoiPts(0) , numPts)
     
     ret = IpAnCreateObj(GO_OBJ_POLY) ' create annotation object representing AOI
     ret = IpAnPolyAddPtArray(aoiPts(0), numPts)
     ret = IpAnSet(GO_ATTR_CONNECT, 1)
     ret = IpAnSet(GO_ATTR_PENCOLOR, ROIpencolor)
     IpAnSet(GO_ATTR_PENSTYLE, i)
     
     PolyAOItext.Left = aoiPts(0).x
     PolyAOItext.top = aoiPts(0).y
     PolyAOItext.Right = aoiPts(0).x + 100
     PolyAOItext.bottom = aoiPts(0).y + 100
     
     ret = IpAnCreateObj(GO_OBJ_TEXT)
     ret = IpAnMove(0, PolyAOItext.Left, PolyAOItext.top)
     ret = IpAnSet(GO_ATTR_FONTSIZE, 16)
     ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1)
     ret = IpAnSet(GO_ATTR_TEXTCOLOR, 255)
     ret = IpAnText(IpTrim(ROItext(i)))
     ret = IpAnMove(5, PolyAOItext.Right, PolyAOItext.bottom)

   End Select
   
   ReDim HistogramStats(10) As Single
   ReDim HistogramRange(10) As Single
   ret = IpHstGet(GETSTATS, 0, HistogramStats(0))
   ret = IpHstGet(GETRANGE, 0, HistogramRange(0))
   ret = IpOutput(Format$(HistogramStats(0),"##.000000") & tb)
'   ret = IpMacroWait(4)

  Next i
   Debug.Print ""
  ret = IpSeqPlay(SEQ_NEXT) 'Go to the next frame
 Next k 
End Sub

Private Sub AnnotateDelete()
 Dim nObj As Integer
 Dim nList() As Long
 Dim i As Integer
 Dim nObjects As Integer
 
 ' Check the number of annotation objects
 ret = IpAnGet(GO_OBJ_NUMBER, nObj)
 If nObj = 0 Then GoTo Finished

 ' Get their ID's (which are probably not sequential)
 ReDim nList(nObj)
 For i=0 To (nObj-1)
  nList(i+1) = IpAnGet(GO_OBJ_INDEX, i)
 Next
 
 ' Select and delete them
 For i=0 To (nObj-1)
  ret = IpAnActivateObjID(nList(i+1))
  ret = IpAnDeleteObj()
 Next
' ret = IpClprDeleteSampler() 'also delete any caliper which might exist
 ret = IpAoiMultAppend(0) 'and multiple AOI's
 ret = IpAoiShow(FRAME_NONE) 'and hide all AOI's

Finished:
End Sub

Function CreateDefaultPaths()
 Dim AppDir As String * 255
 Dim AppPathName As String
 ret = IpOutputShow(0)
 ret = IpAppGetStr(GETAPPDIR, 0, AppDir)
 AppPathName = IpTrim$(AppDir)
End Function 

 

From: http://www.mediacy.com/index.aspx?page=SolutionsZone


阅读全文 | 回复(8) | 引用通告 | 编辑
 


  • 标签:IPP 
  • Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    heather(游客)发表评论于2006-10-13 9:00:55
    heather(游客)ipp的功能看起来很强大,但是目前我能使用的只有几个功能而已。可以把ipp5.1发给我吗?

    niechunhong2000@yahoo.com.cn

    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    max(游客)发表评论于2006-4-7 20:28:42
    max(游客)有必要用这个macro么?intensity trace一下就可以了。

    以下为blog主人的回复:

     没见到IPP有这样的功能。还请指教。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    hi(游客)发表评论于2006-3-27 21:58:53
    hi(游客)

    thinker您好 我想用Image pro plus分析準分子雷射結晶的顆粒大小各佔多少%

    煩請教學!烦请回复!谢谢!!


    以下为blog主人的回复:

     说得不详细。结你结晶的概念不是很清楚。不过我想你应该用measure-count/size来测量。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    aham(游客)发表评论于2006-3-26 20:07:11
    aham(游客)请问5.1版本的ipp怎么破解呢,能给我点消息吗?punkx@163.com 期待您的回复!!谢谢1!

    以下为blog主人的回复:

     目前IPP是有版权的。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    bio(游客)发表评论于2006-3-18 11:26:55
    bio(游客)

    fura-2这个染料是要用两种发射光的RATIO来确定荧光强度的变化的。这是要在CONFOCAL采集的时候做的事,软件就无能为力了。需要强调的是,在软件处理的时候,先要转换图形的格式。而且适合测量相对荧光强度的变化,要测量绝对值时就要小心了。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    羊角面包(游客)发表评论于2006-3-17 9:47:49
    羊角面包(游客)

    thinker您好,我在image-pro plus的官方网站上看到对用该软件进行定量分析的回答,http://support.mediacy.com/answers/showquestion.asp?faq=36&fldAuto=325,网页再次强调了用该软件进行定量分析的结果是及其不准确的,不过也提到了有两种改进方法:其中之一是测定同一种染料不同发射光的Ration比值,我想请问一下thinker,该怎样使用Ration值进行定量分析呢?

    谢谢了!!


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    westchina(游客)发表评论于2006-3-4 1:50:06
    westchina(游客)

    版主你好。我最近一直在寻找Image pro plus 5.1软件,心情焦急,可以将你的软件分享传给我吗?谢谢。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    Re:Image pro plus 5.1用Macro计算TIME LASPE的荧光强度
    lygmahao(游客)发表评论于2006-2-26 15:09:55
    lygmahao(游客)

    斑竹,

        你好,刚刚搜索到你的文章。不只能有Image pro plus 5.1软件。

    email:lygmahao@163.com

    烦请回复!

    谢谢!!


    以下为blog主人的回复:

     意思没说清楚啊。不明白。


    个人主页 | 引用 | 返回 | 删除 | 回复
     


    发表评论:
    生物导航网博客欢迎您......



    Powered by Oblog.