Channel extraction macro not working correctly after update to version 10.0.4
After updating Image-Pro from version 10.0.2 to 10.0.4 a procedure does not work anymore. I use a macro ExtractZStacksFromActiveImage published in this board to extract exactly one channel.
Public Sub ExtractZStacksFromActiveImage
Dim imset As MediaCy.IQL.Sets.McImageSet=ThisApplication.ActiveDocument.Data
If imset Is Nothing Then Exit Sub'this is not image set
'get number of channels in stack
'Dim nChannels As Long=imset.GetDimensionLength(mcImageSetDimensions.mcisdChannel,imset.GetCurrentLocation)
'For chInd As Integer=0 To nChannels-1
' ExtractZStackFromChannel(imset,chInd)
'Next
ExtractZStackFromChannel(imset,2)
End Sub
Public Sub ExtractZStackFromChannel(imset As MediaCy.IQL.Sets.McImageSet,chInd As Long)
Dim setLoc As New MediaCy.IQL.Sets.McImageSetLocations
'select channel to location
setLoc.Add(mcImageSetDimensions.mcisdChannel, chInd)
'get number of frames in Z dimension
Dim nZframes As Long=imset.GetDimensionLength(mcImageSetDimensions.mcisdZ,setLoc)
'create region to extract
Dim theRegion As MediaCy.IQL.Sets.McImageSetRegion=ThisApplication.CreateOperator("McImageSetLib.McImageSetRegion")
Dim theSections As MediaCy.IQL.Sets.McImageSetSections = theRegion.Sections
theSections.Add(mcImageSetDimensions.mcisdChannel,chInd,1)
theSections.Add(mcImageSetDimensions.mcisdZ,0,nZframes)
'create image of Z frames (invisible)
Dim outIm As McImage=imset.ExtractImage(theRegion, mcImageCreateFlags.mcicfNotVisible Or mcImageCreateFlags.mcicfNoAddToCollection)
'show image
outIm.Visible=True
End Sub
How can I fix this?
Thanks in advance
fsup
0
Comments
-
Hi fsup,
Thanks for reporting this. I can reproduce the problem and we will fix it, but for now, please use a new version of the macro:Public Sub ExtractZStackFromChannel(imset As MediaCy.IQL.Sets.McImageSet,chInd As Long) Dim setLoc As New MediaCy.IQL.Sets.McImageSetLocations 'select channel to location setLoc.Add(mcImageSetDimensions.mcisdChannel, chInd) 'get number of frames in Z dimension Dim nZframes As Long=imset.GetDimensionLength(mcImageSetDimensions.mcisdZ,setLoc) Dim srcs As McImageSetSources=imset.GetSourcesAlongDimension(setLoc,mcImageSetDimensions.mcisdZ) 'duplicate channel image Dim outIm As McImage=srcs.Item(0).Image.Duplicate(mcImageCreateFlags.mcicfNotVisible Or mcImageCreateFlags.mcicfNoAddToCollection) 'show image outIm.Visible=True End SubLet me know if it works for you.
Yuri0 -
Hi Yuri,the macro works fine now.Thank you for supporting me.fsup0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions
