[Paraview-developers] Reading NIFTI RGB(A) and unsigned int types
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Tue Feb 14 11:42:46 EST 2012
Thanks Philip.
Joe, do these changes look okay to you? If so, I can merge the patch
into ParaView.
Utkarsh
On Tue, Feb 14, 2012 at 11:24 AM, Philip A Cook
<cookpa at mail.med.upenn.edu> wrote:
> Hi,
>
> With a few simple changes to Plugins/AnalyzeNIfTIReaderWriter/vtkNIfTIReader.cxx, I was able to make Paraview read NIFTI RGB and RGBA images, and also NIFTI unsigned short and int data types.
>
> I tried to register for git access a week or two ago, but I haven't heard back. I've tested the patch on 3.12 and 3.14 RC2 (commit 1635f2e9eb4edabaa61a97f59d8f2febf20b5f1c). RGBA was a bit strange on 3.12 (zero alpha would be opaque sometimes) but it seems to work OK now.
>
>
> Phil
>
> diff --git a/Plugins/AnalyzeNIfTIReaderWriter/vtkNIfTIReader.cxx b/Plugins/AnalyzeNIfTIReaderWriter/vtkNIfTIReader.cxx
> index def6645..21fc3b3 100644
> --- a/Plugins/AnalyzeNIfTIReaderWriter/vtkNIfTIReader.cxx
> +++ b/Plugins/AnalyzeNIfTIReaderWriter/vtkNIfTIReader.cxx
> @@ -258,23 +258,37 @@ void vtkNIfTIReader::ExecuteInformation()
> this->SetDataScalarTypeToShort();
> dataTypeSize = 2;
> break;
> + case DT_UINT16:
> + this->SetDataScalarTypeToUnsignedShort();
> + dataTypeSize = 2;
> + break;
> case DT_SIGNED_INT:
> this->SetDataScalarTypeToInt();
> dataTypeSize = 4;
> break;
> + case DT_UINT32:
> + this->SetDataScalarTypeToUnsignedInt();
> + dataTypeSize = 4;
> + break;
> case DT_FLOAT:
> this->SetDataScalarTypeToFloat();
> dataTypeSize = 4;
> break;
> case DT_DOUBLE:
> - this->SetDataScalarTypeToDouble();
> + this->SetDataScalarTypeToDouble();
> dataTypeSize = 8;
> break;
> case DT_RGB:
> - // DEBUG -- Assuming this is a triple, not quad
> - //image.setDataType( uiig::DATA_RGBQUAD );
> + this->SetDataScalarTypeToUnsignedChar();
> + numComponents = 3;
> + dataTypeSize=3;
> break;
> - default:
> + case DT_RGBA32:
> + this->SetDataScalarTypeToUnsignedChar();
> + numComponents = 4;
> + dataTypeSize=4;
> + break;
> + default: // Error gets thrown by ExecuteData if type is not set
> break;
> }
> //
>
> _______________________________________________
> Paraview-developers mailing list
> Paraview-developers at paraview.org
> http://public.kitware.com/mailman/listinfo/paraview-developers
More information about the Paraview-developers
mailing list