diff --git a/index.html b/index.html index fcfeed8..9d3d3b4 100644 --- a/index.html +++ b/index.html @@ -293,6 +293,57 @@ + + +
  • + + + ImodModel + + + + +
  • @@ -345,6 +396,57 @@ +
  • + +
  • + + + ImodModel + + + + +
  • @@ -396,20 +498,85 @@

    Usage

    3 0 0 87.333336 49.666668 80.0 4 0 0 76.000000 82.000000 80.0 -

    Annotations made in the slicer window are stored in the IMOD binary file with both centerpoints and angles.

    -

    These annotations can be read in by setting annotation='slan' when calling imodmodel.read()

    +

    Slicer angles saved in the slicer window +are stored in the IMOD binary file with both centerpoints and angles.

    +

    These annotations can be read in by setting annotation='slicer_angle' when calling imodmodel.read()

    import imodmodel
     
    -df = imodmodel.read('file_with_slicer_angles.mod', annotation='slan')
    +df = imodmodel.read('file_with_slicer_angles.mod', annotation='slicer_angles')
     
    In [3]: df.head()
     Out[3]:
    -   object_id  slan_id  time      x_rot  y_rot      z_rot    center_x    center_y  center_z label
    +   object_id  slicer_angle_id  time      x_rot  y_rot      z_rot    center_x    center_y  center_z label
     0          0        0     1  13.100000    0.0 -30.200001  235.519577  682.744141     302.0
     0          0        1     1 -41.400002    0.0 -47.700001  221.942444  661.193237     327.0
     0          0        2     1 -41.400002    0.0 -41.799999  232.790726  671.332031     327.0
     0          0        3     1 -35.500000    0.0 -36.000000  240.129181  679.927795     324.0
     
    +

    ImodModel

    +

    The resulting dataframe from imodmodel.read() contains only information about the contours or slicer angles. +The full set of information from the imod model file can be parsed using ImodModel

    +
    from imodmodel import ImodModel
    +
    +my_model = ImodModel.from_file("my_model_file.mod")
    +
    +
    in [3]: my_model.model_field_set
    +out[3]: 
    +{'id', 'extra', 'objects', 'slicer_angles', 'header'}
    +
    +

    my_model.id

    +

    my_model.id contains the IMOD file id and the version id

    +
    in [4]: my_model.id
    +out[4]: 
    +ID(IMOD_file_id='IMOD', version_id='V1.2')
    +
    +

    my_model.header

    +

    my_model.header is contains the model structure data mainly used by IMOD.

    +
    in [5]: my_model.header
    +out[5]:
    +ModelHeader(name='IMOD-NewModel', xmax=956, ymax=924, zmax=300, objsize=3, flags=62976, drawmode=1,
    +mousemode=1, blacklevel=145, whitelevel=173, xoffset=0.0, yoffset=0.0, zoffset=0.0, xscale=1.0, yscale=10,
    +zscale=1.0, object=2, contour=-1, point=-1, res=3, thresh=128, pixelsize=1.9733333587646484, units=-9,
    +csum=704518946, alpha=0.0, beta=0.0, gamma=0.0)
    +
    +

    my_model.objects

    +

    my_model.objects is a list IMOD objects.

    +
    in [6]: my_model.objects[0].header
    +out[6]: 
    +ObjectHeader(name='', extra_data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], contsize=0,
    +flags=402653184, axis=0, drawmode=1, red=0.0, green=1.0, blue=0.0, pdrawsize=0, symbol=1, symsize=3,
    +linewidth2=1, linewidth=1, linesty=0, symflags=0, sympad=0, trans=0, meshsize=0, surfsize=0)
    +
    +

    This is where object values like contours, meshes, and IMAT information are located.

    +
    in [7]: my_model.objects[1].meshes[0].indices
    +out[7]: 
    +array([[38, 40, 52],
    +       [38, 52, 50],
    +       [50, 52, 64],
    +       [50, 64, 60],
    +       ...,
    +       [ 4, 10, 26],
    +       [ 4, 26, 20],
    +       [20, 26, 38],
    +       [20, 38, 32]])
    +
    +
    in [8]: my_model.objects[1].imat
    +out[8]: 
    +IMAT(ambient=102, diffuse=255, specular=127, shininess=4, fillred=0, fillgreen=0, fillblue=0,
    +quality=0, mat2=0, valblack=0, valwhite=255, matflags2=0, mat3b3=0)
    +
    +
    in [9]: my_model.objects[1].contours[0].points
    +out[9]:
    +array([[367.00006104, 661.83343506, 134.        ],
    +       [415.66674805, 667.83343506, 134.        ],
    +       [474.33340454, 662.50012207, 134.        ]])
    +
    +

    my_model.slicer_angles

    +

    my_model.slicer_angles is a list of slicer angles.

    +
    in [10]: my_model.slicer_angles[0]
    +out[10]:
    +SLAN(time=1, angles=(0.0, 0.0, 0.0), center=(533.5, 717.0, 126.0), label='\x00')
    +

    That's it!

    Installation

    imodmodel can be installed from the Python Package Index (PyPI)

    diff --git a/search/search_index.json b/search/search_index.json index 90e8986..676b051 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"

    Read IMOD model files as pandas dataframes in Python.

    "},{"location":"#usage","title":"Usage","text":"
    import imodmodel\n\ndf = imodmodel.read('my_model_file.mod')\n
    In [3]: df.head()\nOut[3]: \n   object_id  contour_id          x          y     z\n0          0           0  64.333336  64.666664  80.0\n1          0           0  47.000000  77.333336  80.0\n2          0           0  51.333332  45.666668  80.0\n3          0           0  87.333336  49.666668  80.0\n4          0           0  76.000000  82.000000  80.0\n

    Annotations made in the slicer window are stored in the IMOD binary file with both centerpoints and angles.

    These annotations can be read in by setting annotation='slan' when calling imodmodel.read()

    import imodmodel\n\ndf = imodmodel.read('file_with_slicer_angles.mod', annotation='slan')\n
    In [3]: df.head()\nOut[3]:\n   object_id  slan_id  time      x_rot  y_rot      z_rot    center_x    center_y  center_z label\n0          0        0     1  13.100000    0.0 -30.200001  235.519577  682.744141     302.0\n0          0        1     1 -41.400002    0.0 -47.700001  221.942444  661.193237     327.0\n0          0        2     1 -41.400002    0.0 -41.799999  232.790726  671.332031     327.0\n0          0        3     1 -35.500000    0.0 -36.000000  240.129181  679.927795     324.0\n

    That's it!

    "},{"location":"#installation","title":"Installation","text":"

    imodmodel can be installed from the Python Package Index (PyPI)

    pip install imodmodel\n

    We recommend installing into a clean virtual environment.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"

    Read IMOD model files as pandas dataframes in Python.

    "},{"location":"#usage","title":"Usage","text":"
    import imodmodel\n\ndf = imodmodel.read('my_model_file.mod')\n
    In [3]: df.head()\nOut[3]: \n   object_id  contour_id          x          y     z\n0          0           0  64.333336  64.666664  80.0\n1          0           0  47.000000  77.333336  80.0\n2          0           0  51.333332  45.666668  80.0\n3          0           0  87.333336  49.666668  80.0\n4          0           0  76.000000  82.000000  80.0\n

    Slicer angles saved in the slicer window are stored in the IMOD binary file with both centerpoints and angles.

    These annotations can be read in by setting annotation='slicer_angle' when calling imodmodel.read()

    import imodmodel\n\ndf = imodmodel.read('file_with_slicer_angles.mod', annotation='slicer_angles')\n
    In [3]: df.head()\nOut[3]:\n   object_id  slicer_angle_id  time      x_rot  y_rot      z_rot    center_x    center_y  center_z label\n0          0        0     1  13.100000    0.0 -30.200001  235.519577  682.744141     302.0\n0          0        1     1 -41.400002    0.0 -47.700001  221.942444  661.193237     327.0\n0          0        2     1 -41.400002    0.0 -41.799999  232.790726  671.332031     327.0\n0          0        3     1 -35.500000    0.0 -36.000000  240.129181  679.927795     324.0\n
    "},{"location":"#imodmodel","title":"ImodModel","text":"

    The resulting dataframe from imodmodel.read() contains only information about the contours or slicer angles. The full set of information from the imod model file can be parsed using ImodModel

    from imodmodel import ImodModel\n\nmy_model = ImodModel.from_file(\"my_model_file.mod\")\n
    in [3]: my_model.model_field_set\nout[3]: \n{'id', 'extra', 'objects', 'slicer_angles', 'header'}\n
    "},{"location":"#my_modelid","title":"my_model.id","text":"

    my_model.id contains the IMOD file id and the version id

    in [4]: my_model.id\nout[4]: \nID(IMOD_file_id='IMOD', version_id='V1.2')\n
    "},{"location":"#my_modelheader","title":"my_model.header","text":"

    my_model.header is contains the model structure data mainly used by IMOD.

    in [5]: my_model.header\nout[5]:\nModelHeader(name='IMOD-NewModel', xmax=956, ymax=924, zmax=300, objsize=3, flags=62976, drawmode=1,\nmousemode=1, blacklevel=145, whitelevel=173, xoffset=0.0, yoffset=0.0, zoffset=0.0, xscale=1.0, yscale=10,\nzscale=1.0, object=2, contour=-1, point=-1, res=3, thresh=128, pixelsize=1.9733333587646484, units=-9,\ncsum=704518946, alpha=0.0, beta=0.0, gamma=0.0)\n
    "},{"location":"#my_modelobjects","title":"my_model.objects","text":"

    my_model.objects is a list IMOD objects.

    in [6]: my_model.objects[0].header\nout[6]: \nObjectHeader(name='', extra_data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], contsize=0,\nflags=402653184, axis=0, drawmode=1, red=0.0, green=1.0, blue=0.0, pdrawsize=0, symbol=1, symsize=3,\nlinewidth2=1, linewidth=1, linesty=0, symflags=0, sympad=0, trans=0, meshsize=0, surfsize=0)\n

    This is where object values like contours, meshes, and IMAT information are located.

    in [7]: my_model.objects[1].meshes[0].indices\nout[7]: \narray([[38, 40, 52],\n       [38, 52, 50],\n       [50, 52, 64],\n       [50, 64, 60],\n       ...,\n       [ 4, 10, 26],\n       [ 4, 26, 20],\n       [20, 26, 38],\n       [20, 38, 32]])\n
    in [8]: my_model.objects[1].imat\nout[8]: \nIMAT(ambient=102, diffuse=255, specular=127, shininess=4, fillred=0, fillgreen=0, fillblue=0,\nquality=0, mat2=0, valblack=0, valwhite=255, matflags2=0, mat3b3=0)\n
    in [9]: my_model.objects[1].contours[0].points\nout[9]:\narray([[367.00006104, 661.83343506, 134.        ],\n       [415.66674805, 667.83343506, 134.        ],\n       [474.33340454, 662.50012207, 134.        ]])\n
    "},{"location":"#my_modelslicer_angles","title":"my_model.slicer_angles","text":"

    my_model.slicer_angles is a list of slicer angles.

    in [10]: my_model.slicer_angles[0]\nout[10]:\nSLAN(time=1, angles=(0.0, 0.0, 0.0), center=(533.5, 717.0, 126.0), label='\\x00')\n

    That's it!

    "},{"location":"#installation","title":"Installation","text":"

    imodmodel can be installed from the Python Package Index (PyPI)

    pip install imodmodel\n

    We recommend installing into a clean virtual environment.

    "}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 47bc2ca..0860eaf 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,7 +2,7 @@ https://teamtomo.org/imodmodel/ - 2024-06-08 + 2024-06-13 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 74218ef..07fb779 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ