[vtkusers] imagedata appearing upside down (sometimes..?)
Mathieu Malaterre
mathieu.malaterre at kitware.com
Mon Mar 22 19:23:28 EST 2004
Howard,
Without actually seeing your code, or a simple demo that reproduce this
bug, I can't help you sorry.
Mathieu
Howard Katz wrote:
> Hi,
> Thanks again for your response
>
> Okay actually I am creating the data and inputting it into the array
> So from what I understand the values at row 0 of my array would appear
> at the bottom, and the values at row 100 lets say would appear towards
> the top
>
> So I use subscript math to assign the values in my array as follows:
> array [ row*TotalColumns + col ] = value;
>
> and then do SetVoidArray as mentioned below..
>
> So I'm alawys creating teh data the same way, so why would it sometimes
> appear upside down and sometimes not..? :s
> Thanks again for your help!
>
> Howard
>
>
>> From: Mathieu Malaterre <mathieu.malaterre at kitware.com>
>> To: Howard Katz <lost_bits1110 at hotmail.com>
>> CC: vtkusers at vtk.org
>> Subject: Re: [vtkusers] imagedata appearing upside down (sometimes..?)
>> Date: Mon, 22 Mar 2004 19:10:38 -0500
>>
>> Howard,
>>
>> Ok that's what I wanted ! Where does your data comes from ? Did
>> you know that VTK read the image data upside down ? Have a look at any
>> image reader like png, jpeg, tiff. You'll see that we read starting
>> from the bottom. So make sure your array is read starting from the
>> bottom.
>>
>> Or more generally use an already existing reader.
>>
>> HTH,
>> Mathieu
>>
>> Howard Katz wrote:
>>
>>> Also,
>>> just note that I input data using:
>>>
>>> VelocityVsTimeSampleFloatArray->SetVoidArray(array,TotalTimePoints*TotalCycles*NumBins,
>>> 1 );
>>>
>>> where array is a 1D float array whcih represents a 2D array through
>>> subscirpt arithemtic by doing:
>>>
>>> array [ row*TotalColumns + col ] = value;
>>>
>>> Thanks..!
>>> Howard
>>>
>>>> From: "Howard Katz" <lost_bits1110 at hotmail.com>
>>>> To: mathieu.malaterre at kitware.com
>>>> CC: vtkusers at vtk.org
>>>> Subject: Re: [vtkusers] imagedata appearing upside down (sometimes..?)
>>>> Date: Mon, 22 Mar 2004 23:11:20 +0000
>>>>
>>>> Hi,
>>>>
>>>> I called GetSpacing and it returns (1,1,1) just as I had specified..
>>>> And I know the input values are correct i.e they're not negative or
>>>> anything because I also outputted this..
>>>> And I noticed that whenever I don't add a camera to my renderer,
>>>> nothing happens when I change the spacing, is this normal?
>>>> Okay below is some C++ code,
>>>> So again its werid because the whole thing appears upside down only
>>>> for some cases and not others..?
>>>> Anyways here it is:
>>>>
>>>> VelocityVsTimeSampleFloatArray->SetNumberOfComponents(1);
>>>> VelocityVsTimeSampleFloatArray->SetNumberOfTuples(TotalCycles*NumVelocityBins*TotalTimePoints
>>>> );
>>>> VelocityVsTimeSampleImageData->SetOrigin(-30, -85, 0);
>>>>
>>>> VelocityVsTimeSampleImageData->GetPointData()->SetScalars(VelocityVsTimeSampleFloatArray);
>>>>
>>>>
>>>> VelocityVsTimeSampleImageData->SetDimensions(TotalCycles*TotalTimePoints,NumVelocityBins,
>>>> 1);
>>>> VelocityVsTimeSampleImageData->SetScalarType(VTK_FLOAT);
>>>> VelocityVsTimeSampleImageData->SetSpacing(1, 1, 1);
>>>>
>>>> ImageCast->SetInput( VelocityVsTimeSampleImageData);
>>>> ImageCast->SetOutputScalarTypeToUnsignedChar();
>>>>
>>>> ImageMapToColors->SetInput(ImageCast->GetOutput());
>>>> ImageMapToColors->SetLookupTable(SpectLUT);
>>>>
>>>> SpectActor->SetInput(ImageMapToColors->GetOutput());
>>>> SpectActor->SetDisplayExtent( 0, TotalCycles*TotalTimePoints-1, 0,
>>>> NumVelocityBins-1, 0, 0 );
>>>>
>>>> Cam->SetPosition(0, 0, 325);
>>>> Cam->SetFocalPoint(0,0,0);
>>>>
>>>> Ren1->SetBackground(0.3, 0.3, 0.3);
>>>> Ren1->SetActiveCamera(Cam);
>>>> Ren1->AddActor( SpectActor );
>>>>
>>>> RenWin->AddRenderer( Ren1 );
>>>> RenWin->SetSize( 500, 500 );
>>>> RenWin->SetInteractor(Iren);
>>>> Iren->SetStillUpdateRate(1000);
>>>> Iren->SetDesiredUpdateRate(1000);
>>>> Iren->Initialize();
>>>> Iren->Render();
>>>>
>>>>
>>>>
>>>>
>>>>> From: Mathieu Malaterre <mathieu.malaterre at kitware.com>
>>>>> To: Howard Katz <lost_bits1110 at hotmail.com>
>>>>> CC: vtkusers at vtk.org
>>>>> Subject: Re: [vtkusers] imagedata appearing upside down (sometimes..?)
>>>>> Date: Mon, 22 Mar 2004 17:34:30 -0500
>>>>>
>>>>> Howard,
>>>>>
>>>>> What does :
>>>>>
>>>>> //Call Update() before
>>>>> print imagedata.GetSpacing()
>>>>>
>>>>> return ?
>>>>> Could you reproduce the bad behavior using a tests from VTK ? Or
>>>>> could you send us a python/c++/tcl code that shows this problem.
>>>>>
>>>>> Thanks
>>>>> Mathieu
>>>>>
>>>>> Howard Katz wrote:
>>>>>
>>>>>> Hi..
>>>>>> What do you mean my spacing 'can' be negative...?
>>>>>> :S
>>>>>> Thanks again..!
>>>>>>
>>>>>>
>>>>>>
>>>>>>> From: Mathieu Malaterre <mathieu.malaterre at kitware.com>
>>>>>>> To: Howard Katz <lost_bits1110 at hotmail.com>
>>>>>>> CC: vtkusers at vtk.org
>>>>>>> Subject: Re: [vtkusers] imagedata appearing upside down
>>>>>>> (sometimes..?)
>>>>>>> Date: Mon, 22 Mar 2004 13:13:18 -0500
>>>>>>>
>>>>>>> Howard Katz wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> so has anyone run into the problem where their vtkImageData
>>>>>>>> looks upside down only sometiems depending on the input
>>>>>>>> values..? i.e. I know I am inputting values 10, 20, 15 (for
>>>>>>>> example) but these appear at rows -10, -20, -15 (..and this
>>>>>>>> will happen for the entire image data)
>>>>>>>>
>>>>>>>> Can anyoen guess what my problem might be?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> You spacing can be negative, this happens typically in medical
>>>>>>> image data such a MINC or DICOM
>>>>>>>
>>>>>>> HTH
>>>>>>> Mathieu
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _________________________________________________________________
>>>>>> All the action. All the drama. Get NCAA hoops coverage at MSN
>>>>>> Sports by ESPN. http://msn.espn.go.com/index.html?partnersite=espn
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> This is the private VTK discussion list. Please keep messages
>>>>> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>>
>>>>
>>>> _________________________________________________________________
>>>> Get tax tips, tools and access to IRS forms – all in one place at
>>>> MSN Money! http://moneycentral.msn.com/tax/home.asp
>>>>
>>>> _______________________________________________
>>>> This is the private VTK discussion list. Please keep messages
>>>> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>>
>>> _________________________________________________________________
>>> Is your PC infected? Get a FREE online computer virus scan from
>>> McAfee® Security.
>>> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list. Please keep messages
>>> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>>
>>
>
> _________________________________________________________________
> Check out MSN PC Safety & Security to help ensure your PC is protected
> and safe. http://specials.msn.com/msn/security.asp
>
>
More information about the vtkusers
mailing list