Print

Print


Hi Vasudev,

You'd have to write your own program I'm afraid. A possible algorithm would
be to start by making sure that both the Wavefront and the NIFTI file to be
masked have the same coordinate system. Then create a 3D array full of
zeros (0) of the same size of the NIFTI. Then subdivide each triangle of
the .obj file into multiple smaller triangles such that they become well
smaller than the voxel size. One way of accomplishing this is by recursive
subdivision, i.e., split each edge into 2 parts, which produces 4 new
triangles for each original triangle. Then for each voxel of the 3D array,
check whether it contains any vertex inside it. If yes, fill it with "1",
otherwise, leave it with zero. Then save as NIFTI.

If you need fuzzy masking, create the 3D array with a higher resolution
than the intended final NIFTI output. Then do as above and at the far end,
downsample using an existing tool, e.g., FLIRT, with trilinear or sinc
interpolation.

The above assumes that there is just one surface (e.g., representing the
pia-mater, for instance). If there are two surfaces that delineate the
cortical gray matter, it's simpler then: for each voxel, check if its
centre is within the cortex or not. If yes, mark it with 1.

If the surfaces represent subcortical volumes, then finding whether the
centre of a voxel is inside is the 3D version of the well known "point in
polygon" problem. Perhaps this Wikipedia article and the references therein
could be a good starting point: https://en.wikipedia.
org/wiki/Point_in_polygon

There are certainly other way, the above is just a suggestion.

All the best,

Anderson


On 2 February 2017 at 16:01, Dev vasu <[log in to unmask]>
wrote:

> Dear Sir,
>
> Is there any other procedure to change .obj file into some surface file ,
> I am asking this since the parcellations are in .obj format , i dont know
> how i could possibly use them as a ROI mask.
>
> Thanks
> Vasudev
>
> On 2 February 2017 at 10:00, Anderson M. Winkler <[log in to unmask]>
> wrote:
>
>> Hi Vasudev,
>>
>> A .obj file is vector-based, whereas NIFTI is raster. It is not possible
>> to make a conversion that retains the benefits of a vector format.
>>
>> All the best,
>>
>> Anderson
>>
>>
>> On 1 February 2017 at 18:01, Dev vasu <vasudevamurthy.devulapally@gm
>> ail.com> wrote:
>>
>>> Dear Paul,
>>>
>>> How can i convert .asc file using mris_convert to nifti its not possible
>>> , its possible to convert to GIFTI not Nifti , is there any other way
>>> please let me know.
>>>
>>>
>>> Thanks
>>> Vasudev
>>>
>>> On 1 February 2017 at 18:51, Paul Robinson <[log in to unmask]>
>>> wrote:
>>>
>>>> Hi, Vasudev.
>>>>
>>>> See https://brainder.org/2012/05/08/importing-freesurfer-cor
>>>> tical-meshes-into-blender/ for some handy conversion scripts between
>>>> .obj. and FreeSurfer formats. You should then be able to use mri_convert to
>>>> go to NIfTI.
>>>>
>>>> Hth!
>>>> Paul
>>>>
>>>> On Wed, Feb 1, 2017 at 9:42 AM, Dev vasu <vasudevamurthy.devulapally@gm
>>>> ail.com> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> Could you please suggest me some method where i can possibly convert
>>>>> Wavefront .obj files into Nifti files, is such conversion technically
>>>>> relevant ?.
>>>>>
>>>>>
>>>>> Thanks
>>>>> Vasudev
>>>>>
>>>>
>>>>
>>>
>>
>