lesion segmentation
lesion segmentation
Hi,
is there a tool in brainvisa to automatically perform a 3D ROI of a lesion (part of the brain removed, so no need of a crazy algorithm).
is there a tool in brainvisa to automatically perform a 3D ROI of a lesion (part of the brain removed, so no need of a crazy algorithm).
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: lesion segmentation
Hi,
There is no specific lesion segmentation tool in BrainVisa. You can try the "magic brush" tool of the ROI drawing toolbox of Anatomist (I don't guarantee that it is the exact tool you need...)
Denis
There is no specific lesion segmentation tool in BrainVisa. You can try the "magic brush" tool of the ROI drawing toolbox of Anatomist (I don't guarantee that it is the exact tool you need...)
Denis
Re: lesion segmentation
thanks.
I'll take a look at the magic brush soon.
I'll take a look at the magic brush soon.
Re: lesion segmentation
would it be possible to subtract the T1 post resection from the T1 pre resection ?
that could help me.
I have the transformation matrix so I can see them coregistered on anatomist. But I don't know how to subtract the two images. I can do the fusion, but not the subtraction for now.
that could help me.
I have the transformation matrix so I can see them coregistered on anatomist. But I don't know how to subtract the two images. I can do the fusion, but not the subtraction for now.
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: lesion segmentation
Hi,
You mean using the image processing tools, or visually ?
You can do many operations using masking and additions/substractions, using AimsMask, cartoLinearComb.py or other commands. To do so you will need to resample one of the images to the space of the other (AimsResample)...
Visually in anatomist, there is no "substraction" mode, that's right, you can perhaps do something by inverting the colormap of one of the images in the fusion (setting the max lower than the min).
I don't know if I am answering your question ?
Denis
You mean using the image processing tools, or visually ?
You can do many operations using masking and additions/substractions, using AimsMask, cartoLinearComb.py or other commands. To do so you will need to resample one of the images to the space of the other (AimsResample)...
Visually in anatomist, there is no "substraction" mode, that's right, you can perhaps do something by inverting the colormap of one of the images in the fusion (setting the max lower than the min).
I don't know if I am answering your question ?
Denis
Re: lesion segmentation
I was hopping a visualization method, to not have to resample the images.
I'll try the inversion of the colormap and fusion, I didn't thought about it but it should worls.
otherwise I'll resample.
Thanks !
I'll try the inversion of the colormap and fusion, I didn't thought about it but it should worls.
otherwise I'll resample.
Thanks !
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: lesion segmentation
OK. The thing is that fusions in Anatomist are merging images after going through the colormaps: they are working in RGB space, and not in image space, thus they do not provide direct ways to perform image-space operations (additions, subtractions or masking). That's something which has been in the TODO list for years... It would be useful.
Denis
Denis
Re: lesion segmentation
I have a logical array of my lesion that I want to convert into ROI (in order to use roi tools to correct manually the lesion segmentation, the eraser mainly as my automatic segmentation can take a little bit of the ventricles sometimes).
and reconvert it after in logical array. is that possible ?
and reconvert it after in logical array. is that possible ?
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: lesion segmentation
Yes it is possible.
Anatomist uses its own format for ROIs (".arg"), which is a "graph" format (also used for sulci and other sets of objects). Conversion from/to label images is possible using the "AimsGraphConvert" command:
To convert an image to ROIs set:
To convert a ROI set to a labels image, it is a bit more indirect:
This actually converts a .arg ROI graph into another .arg graph, but which contains an image (instead of voxels lists). The label image is found in the roi_volume.data directory then (should be named something like "roi_image_Volume.nii")
In BrainVisa there are some processes wrapping it: in Tools/converters: Volume To ROI Converter" and "Graph To Volume Converter".
Denis
Anatomist uses its own format for ROIs (".arg"), which is a "graph" format (also used for sulci and other sets of objects). Conversion from/to label images is possible using the "AimsGraphConvert" command:
To convert an image to ROIs set:
Code: Select all
AimsGraphConvert -i image.nii -o roi.arg
Code: Select all
AimsGraphConvert -o roi.arg -o roi_image.arg --volume
In BrainVisa there are some processes wrapping it: in Tools/converters: Volume To ROI Converter" and "Graph To Volume Converter".
Denis
Re: lesion segmentation
I works perfectly with a lot of manual step.
I try to reduce the number of manual step for neurologist users and I have some problem.
I have my nii file which is in the directory '/Center/Subject/Resection/' with a resection.nii and a resection.nii.minf files.
if I do
it works perfectly. I have the tmproi.arg file (it generates : '/Center/Subject/Resection/tmproi.arg' and '/Center/Subject/Resection/tmproi.data') that I can open via the roi gui and modify etc ... but I have to add manually the referential etc ...
I tried to do that to do more step on the roi file via command line
but the line doesn't work.
I have this error message:
the folder /center/subject/diffusion doesn't exist but why is it looking for a diffusion folder ?
I try to reduce the number of manual step for neurologist users and I have some problem.
I have my nii file which is in the directory '/Center/Subject/Resection/' with a resection.nii and a resection.nii.minf files.
if I do
Code: Select all
ret = subprocess.call(['AimsGraphConvert', '-i', str(di_resec.fullPath()), '-o', str(os.path.dirname(di_resec.fullPath()))+'tmproi.arg'])
I tried to do that to do more step on the roi file via command line
Code: Select all
wdi_resec_roi = WriteDiskItem( 'ROI', 'Graph and Data' )
di_resec_roi = wdi_resec_roi.findValue({'subject':self.brainvisaPatientAttributes['subject'], 'center':self.currentProtocol, 'acquisition':'Resection'})
ret = subprocess.call(['AimsGraphConvert', '-i', str(di_resec.fullPath()), '-o', di_resec_roi.fullPath()])
if ret < 0:
QtGui.QMessageBox.warning(self, "Erreur", "roi conversion failed")
return
neuroHierarchy.databases.insertDiskItem( di_resec_roi, update=True )
self.transfoManager.setReferentialTo(di_resec_roi, self.diskItems['T1pre'].attributes()['referential'] )
Code: Select all
ret = subprocess.call(['AimsGraphConvert', '-i', str(di_resec.fullPath()), '-o', di_resec_roi.fullPath()])
I have this error message:
Code: Select all
ret = subprocess.call(['AimsGraphConvert', '-i', str(di_resec.fullPath()), '-o', di_resec_roi.fullPath()])
saving all
/center/subject/diffusion/Resection/default_analysis/default_tracking_session/regions_subject_default_tracking_session.data: No such file or directory
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: lesion segmentation
Hi,
OK several things are going on in your example:
- you are using the "ROI" type, which is used through derived (more specialized) types only in the database organization provided by brainvisa. Thus finding the placement of an output data of this type is likeky to be ambiguous or trigger a rule designed for another kind of specialized data. Here it happens that the (old) tracking toolboxes is using ROIs (of type " Tracking regions graph", inheriting "ROI"), which can be placed in the files organization with a higher priority than other ROI types. Thus it is what "wdi_resec_roi.findValue(...)" returns you: di_resec_roi.type() is not directly a "ROI" here.
You should rather define a subtype for your needs and define a placement for it in the hierarchy.
- As you define wdi_resec_roi and its value duriring the execution of a script (it is not a parameter of a process), BrainVisa cannot create the directory which will hold the data. So here AimsGraphConvert is trying to write in a non-existing directory. If you have to do so, you must take care of creating the parent directories first.
- As I said in the last message, there are already processes to convert between label images and graphs in BV: "Volume To ROI Converter" and "Graph To Volume Converter". (You can use them from a script if needed)
Denis
OK several things are going on in your example:
- you are using the "ROI" type, which is used through derived (more specialized) types only in the database organization provided by brainvisa. Thus finding the placement of an output data of this type is likeky to be ambiguous or trigger a rule designed for another kind of specialized data. Here it happens that the (old) tracking toolboxes is using ROIs (of type " Tracking regions graph", inheriting "ROI"), which can be placed in the files organization with a higher priority than other ROI types. Thus it is what "wdi_resec_roi.findValue(...)" returns you: di_resec_roi.type() is not directly a "ROI" here.
You should rather define a subtype for your needs and define a placement for it in the hierarchy.
- As you define wdi_resec_roi and its value duriring the execution of a script (it is not a parameter of a process), BrainVisa cannot create the directory which will hold the data. So here AimsGraphConvert is trying to write in a non-existing directory. If you have to do so, you must take care of creating the parent directories first.
- As I said in the last message, there are already processes to convert between label images and graphs in BV: "Volume To ROI Converter" and "Graph To Volume Converter". (You can use them from a script if needed)
Denis