Closed NicoKiaru closed 1 month ago
You can create two Transformed channel servers that each extract a given channel, apply the desired op and then recombine them into a third server that you pass on to cell pose, but all that needs to be done outside the builder
You then need to set the current image data to point to the new server you created.
You can see this post for inspiration https://forum.image.sc/t/specify-intensity-measurements-for-cellpose-extension-in-qupath/99814/2?u=oburri
Oui mon capitaine!
(Where I'm sttrugling is to go from an image server to a transformed image server where I apply a series of ImageOps. I'll dig and will find, but I'm going to do that in an IDE first: looking for the right way from scratch from groovy is a pain)
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
A better solution is to use a SplitMerge
op like in the example below
sequentialOps = [ ImageOps.Core.splitMerge(
ImageOps.Core.sequential(
ImageOps.Channels.extract( myFirstChannel ),
ImageOps.Core.sqrt() // Keep appending more ops after extracting the channel(s)
),
ImageOps.Core.sequential(
ImageOps.Channels.extract( mySecondChannel ), // Extract the other channel
ImageOps.Core.clip( 100,17000 ) // Keep appending more ops
) // You can keep appending `sequential` ops that will make more channels in the end. Always extract the channel(s) first
)
]
}
// the above will produce a 2 channel image for cellpose
def cellpose = Cellpose2D.builder( pathModel )
// Apply these ops and you can add any extra ops that you want to apply to all channels like usual
.preprocess( *sequentialOps, ImageOps.Filters.gaussianBlur(3), ImageOps.Filters.median(2), ImageOps.Core.sqrt() )
...
Hi!
Is there a way to preprocess differently the channel 1 and channel 2 ? Are imageops applied identically to all channels ?